Input fields on a registration page are used to set the ProfileFormHandler’s value property. The value property is a Dictionary of property/value pairs that temporarily stores pending values for an operation on the current profile. This enables the ProfileFormHandler to set all profile properties on form submission as a single transaction, so profile properties are not left in an inconsistent state.

For example, the following extract from a registration form gathers a user’s name, email address, and gender. The value Dictionary stores user entries as property/value pairs. When the form is successfully submitted, the ProfileFormHandler.create operation creates a user profile and writes the contents of the value Dictionary to the corresponding profile properties.

First Name: <dsp:input bean="ProfileFormHandler.value.firstname" maxlength="30"
size="25" type="text"/>
Last Name: <dsp:input bean="ProfileFormHandler.value.lastname" maxlength="30"
 size="25" type="text"/>
Email Address: <dsp:input bean="" maxlength="30"
 size="25" type="text"/>
<dsp:input bean="ProfileFormHandler.value.gender" type="radio"
<dsp:input bean="ProfileFormHandler.value.gender" type="radio" value="male"/>Male
<dsp:input bean="ProfileFormHandler.create" type="submit" value=" Save "/>

Property/value pairs in the value Dictionary do not always correspond to profile properties; some might be required by the form handler in order to perform its operations. For example, a Change Password form should provide three input text fields, as shown here:

<dsp:input bean="ProfileFormHandler.value.oldpassword" maxsize="35" size="35"
<dsp:input bean="ProfileFormHandler.value.password" maxsize="35" size="35"
<dsp:input bean="ProfileFormHandler.value.confirmpassword" maxsize="35" size="35"
<dsp:input bean="ProfileFormHandler.changePassword" type="submit" value="Save New

The value Dictionary stores the values from all fields; but only one—value.password—is written to the profile. The other two—value.oldpassword and value.confirmpassword—are required by the ProfileFormHandler to verify the user’s identity, and to confirm that the user entered the new password correctly, respectively. If both conditions are true, the ProfileFormHandler.changePassword operation updates the profile password; otherwise, it returns an error.

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices