In order to facilitate updates to multi-valued profile properties, the ProfileFormHandler provides the addMulti operation. This operation appends a new value to a multi-valued property in the ProfileFormHandler's value Dictionary. addMulti can add multiple primitive values to types array, set and list. The addMulti feature cannot handle multiple Map type values, or multiple items, as opposed to primitive data. To add multiple items, you must write your own form handler, as described in the Working with Forms and Form Handlers chapter of the Platform Programming Guide.

Unlike the other ProfileFormHandler operations, addMulti does not update the user profile when its submit button is clicked. Instead, it appends the entered value to the value Dictionary. Thus, the form user can add multiple values to the property before submitting them. Therefore, a page that implements an addMulti submit button must also provide a submit button that creates or updates the user profile.

The following code shows how a form might contain an addMulti operation:

<dsp:select multiple="true" bean="ProfileFormHandler.value.interests"
name="interests" size="4">
  <dsp:droplet name="ForEach">
    <dsp:param bean="ProfileFormHandler.value.interests" name="array"/>
    <dsp:oparam name="output">
       <dsp:option paramvalue="element" selected="true"/><dsp:valueof

<dsp:input name="Add Interests" type="hidden" value="AddMultiProperty_interests,
<dsp:input name="AddMultiProperty_interests" type="hidden"
<dsp:input name="AddMultiValue_interests" type="text"/>
<dsp:input bean="ProfileFormHandler.addMulti" name="addMultiProperty"
type="submit" value="Add Interests">

This code example contains the following steps:

  1. The dsp:select tag specifies how many values for the interests field are available in the form.

  2. The ForEach servlet bean iterates through the array of Strings specified in the bean.ProfileFormHandler.value.interests parameter. If an interest is selected, it outputs the value; otherwise, it outputs null as the interest element value.

  3. A hidden input tag defines two text strings; these strings link the next two subsequent input tags:

    • AddMultiProperty_interests is referenced by a hidden input tag’s name attribute; this input tag’s value attribute identifies the target Dictionary property.

    • AddMultiValue_interests is referenced by the text input tag’s name attribute. Form users use this field to enter new values for the target property.

    The tag’s name attribute is set to Add Interests; this links the Dictionary property and text input field with the addMulti submit button.

  4. The tag that defines the addMulti submit button must set its name and value attributes as follows:

    • name must be set to addMultiProperty

    • value must be set to Add Interests

Note: In order to enable addMulti operations for several multi-valued properties on the same page, each property must have its own pair of unique identifiers as described above, and a unique string for its submit button’s value attribute.

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