I am dynamically genearting multi select boxes on jsp. How do I access selected values in my action method when user clicks submit? Following is my jsp.
selectedValuesDropdowns is list defined in the action bean. I can get values if the drop down box is single select. But when it is multiselect I am having issues.
Please put your code in code tags--it's much easier to read.
One option would be to use a map-based action property to group the values from each multi-select. The map key would be a unique ID from the lstRepositoryQueryActionBean (one should try to name collections as a plural to better identify their purpose) and the select's name would use this ID something similar to:
(I may not have the syntax quite right, but it's close :)
The action would have a Map<String, ...> selectedValuesDropdown property.
As a matter of personal opinion, I try not to name my properties/etc. in a way that reflects how they're used on the view side--in my opinion they should be named something that makes sense from the business/design side of things (and naming a bean with a suffix of "Bean" seems a little redundant :)>