A ProfileFormHandler component can be request- or session-scoped. The default scope is request: each time a user accesses a page with a profile form, the ATG platform creates an instance of the ProfileFormHandler that uses the configured values of the component’s properties. You can override the values of these properties using hidden input tags, but the values set this way do not carry over if the user accesses another page with a profile form.

Property values can persist across multiple pages if the ProfileFormHandler is session-scoped. For example, a long registration form might split across two pages, with the second page containing the form’s submit control. Navigation controls enable the user to move between the two pages before submitting the form. In order to retain values from both pages, the ProfileFormHandler must be session scoped; otherwise, values from one page are lost when the user navigates to the other.

If you set the ProfileFormHandler to be session-scoped, be careful how you use hidden input fields to override default property values. The new values remain in effect throughout the session unless explicitly changed. For example, a registration page sets extractDefaultValuesFromProfile to false. If during the same session, the user accesses another page to update profile information, the fields in this form are not filled in with values from the profile unless that page explicitly sets extractDefaultValuesFromProfile back to true.

After a user logs in or submits profile data, the ProfileFormHandler automatically calls the clear operation if clearValuesOnCreate or clearValuesOnUpdate is set to true—the default value for both. The clear operation clears the temporary value Dictionary. This prevents leftover keys from corrupting another form if the user enters new data. This method is useful for session-scoped form: the form can safely retain information across multiple pages in its value Dictionary for a given session, and ensure that the data is cleared on form submission. To call the clear operation on a form, insert this line:

<dsp:setvalue bean="ProfileFormHandler.clear" value=""/>

The clear operation executes when this line is rendered.

loading table of contents...