How to associate a map property to user input field while using formhandler?
HTML forms can set values to formhandler components using bean attribute of dsp:input tags. However if you want to associate user input values to a map attribute it can be done as follows,
Suppose I have a map called primaryAddress in a custom formhandler MyFromHandler and addressLine1, addressLine2, city, state are attributes that needs to be captured from user. In this case we can set 4 input fields and can associated to map attributes directly.
Map property association can be done for multiple values loaded for a hidden variable as well.
HTML forms can set values to formhandler components using bean attribute of dsp:input tags. However if you want to associate user input values to a map attribute it can be done as follows,
<dsp:input bean="FormHandler.map-property" converter="map" value="key=value" />Suppose I have a map called primaryAddress in a custom formhandler MyFromHandler and addressLine1, addressLine2, city, state are attributes that needs to be captured from user. In this case we can set 4 input fields and can associated to map attributes directly.
<dsp:input bean="MyFromHandler.primaryAddress" converter="map" value="addressLine1=" />
<dsp:input bean="MyFromHandler.primaryAddress" converter="map" value="addressLine2=" />
<dsp:input bean="MyFromHandler.primaryAddress" converter="map" value="city=" />
<dsp:input bean="MyFromHandler.primaryAddress" converter="map" value="state=" />
Map property association can be done for multiple values loaded for a hidden variable as well.
<dsp:input bean="MyFromHandler.primaryAddress" converter="map" type="hidden" value="addressLine1=${loadedAddress.addressLine1}, addressLine2=${loadedAddress.addressLine2}, city=${loadedAddress.city}, state=${loadedAddress.state}">
</dsp:input>
I had read this article.. This is very informative article. Thanks for sharing
ReplyDeleteMobile App for Insurance and healthcare
Web application for Insurance
Web application for Government and Education