How to access selected values of dynamically generated multi select list on jsp from action method?
abi chitnis
Greenhorn
Joined: Feb 13, 2009
Posts: 11
posted
0
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 :)>
abi chitnis
Greenhorn
Joined: Feb 13, 2009
Posts: 11
posted
0
Thank you very much David. It solved my problem.
Abhi
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: How to access selected values of dynamically generated multi select list on jsp from action method?