aspose file tools
The moose likes Struts and the fly likes Problem with multiple select object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Problem with multiple select object" Watch "Problem with multiple select object" New topic
Author

Problem with multiple select object

michael dill
Greenhorn

Joined: Oct 18, 2004
Posts: 1
Hi,
I have a select box that I'm populating with choices from a database. It's working well with one exception. The .jsp code looks like this
<html:select property="userRole" multiple="true">
<html ptions collection="labelValues" property="value" labelProperty="label" />
</html:select>

So I'm using two beans here, one with user information and one with the choices for the select list. This displays the select correctly and the option associated with that user is already selected. The problem is if the user has multiple options, they don't fill in.

I'm setting the userRole value of the bean like this:
user
or, for multiples:
user, manager

It works with only one value but breaks for two or more. I've tried saving this in the bean as a String[] and an ArrayList but those don't work either. I've also tried things like user:manager, user;manager.

Any idea what I can do to get my <select> to recognize multiple values?
Thanks in advance,
Mike
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56218
    
  13

Looks like you are using the Struts tags for your form elements. I'll move this along to the Web App Frameworks forum where Struts is discussed.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
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: Problem with multiple select object
 
Similar Threads
html:select errors
set html:option to defalut bean value
Hibernate mapping and versioning issues
html:select html:options error, no getter. please help
Struts Multiselect to Hidden Field