We used a dropdown menu to allow the member to select an alternate shipping address and move it to the default shipping address. The site visitor cannot change the default shipping address on this page by entering a new one; he must edit one of the alternate addresses and move it to the default using the Update & Set As Default button.

The following JSP sample, taken fromaddress_book.jsp demonstrates how the form is created. We listed all the secondaryAddresses and the user’s billingAddress in a select drop-down list in order to display all of the addresses that the user could select as the default shipping address. The form submits back to the page it resides on, address_book.jsp and invokes the method handleSelectDefaultAddress on the form handler B2CProfileFormHandler.

<dsp:form action="address_book.jsp" method="POST">
  Change it to be:
  <dsp:select
       bean="B2CProfileFormHandler.editValue.defaultAddressNickname">
    <dsp:option value="My Billing Address"/>My Billing Address
  <dsp:droplet name="ForEach">
    <dsp:param bean="Profile.secondaryAddresses" name="array"/>
    <dsp:oparam name="output">
      <dsp:getvalueof id="addressId" param="key"
           idtype="java.lang.String">
        <dsp:option value="<%=addressId%>"/>
      </dsp:getvalueof><dsp:valueof param="key"/>
    </dsp:oparam>
  </dsp:droplet>
  </dsp:select>
  <p>
  <dsp:input bean="B2CProfileFormHandler.selectDefaultAddress"
       type="submit" value="Change default"/>
</dsp:form>
 
loading table of contents...