Section: (pj)
Updated: 2021-10-19
Index Return to Main Contents

To get a prefilled dropdown menu:

Active Hold Obsolete

That is, assume you have a bean in some scope named "item." That bean has a getter for the "status" attribute (getStatus). The returns either "A," "H," or "O." This will create a dropdown that displays "Active," "Hold," and "Obsolete." When the user submits the form, you'll have a "status" request parameter with a value of "A," "H," or "O." The cool thing is, Struts with use the "name" and "property" attributes of html:select to preselect the current value.


This looks in some scope for a collection named "ALL_MARKETS." It should contain beans with a getMarketID method and a getLabel method, which become the id and label of the tags. You should also have a getMarket method on your bean that returns a value matching the return of getMarketID.


If an item has many markets, you want the property to return an array (not a collection) of values matching the return of getMarketID(). You do not want an array of beans that also have a getMarketID() method!  


Paul A. Jungwirth.




This document was created by man2html, using the manual pages.
Time: 16:45:10 GMT, April 11, 2022