This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Multiple selection in drop down list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple selection in drop down list" Watch "Multiple selection in drop down list" New topic
Author

Multiple selection in drop down list

Rajagopal Mani
Ranch Hand

Joined: Mar 24, 2011
Posts: 84

Hi,

I can select multiple values in listbox by using <html:select> & <htmlptionCollections>/<htmlptions> tag. But I need to select multiple values from drop down list which means in the drop down list I should able to select multiple values(Becauze dont want multiple lines of listbox). If I use size="1" in <html:select> tag, i can achieve in single line. But it is not look good to select multiple values. I need to do this by using struts or html tag. I am being searched lot in net but did not get any solution. Please help how it can be achieved.

Thanks.
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Try something like


Hope this helps


Ananth Chellathurai [Walk on software]
Rajagopal Mani
Ranch Hand

Joined: Mar 24, 2011
Posts: 84

Hi,

I need dropdown list instead of listbox. If attribute 'multiple' is used on <html:select> tag, it is converted as listbox not as dropdown list. If attribute 'multiple' is not used, the multiple value selection is not possible. I need to achieve both(*1)

*1
(1) Multiple value selection
(2) dropdown list instead of listbox

Please help to achieve the above.
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

You will not be able to do this without the use of javascript as there is no such thing as a multiple selection drop down box in HTML.

Sean


I love this place!
Rajagopal Mani
Ranch Hand

Joined: Mar 24, 2011
Posts: 84

Hi,

Thanks for the information. Can you please provide any related link or sample code to achieve this.
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

if you use jQuery you can check this: http://code.google.com/p/dropdown-check-list/ otherwise you may just want to search about, a lot of people have asked this question but I couldn't really find any other helpful links.

Sean
Rajagopal Mani
Ranch Hand

Joined: Mar 24, 2011
Posts: 84

Hi,

Thanks for the reply. I too found this option during search. I thought to use this if nothing possible by html, javascript & struts. Hope this JQuery option will be pretty good.

Thanks
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

jQuery is JavaScript!
It is just a wrapper around it to make javascript simpler to use, more powerful with the least amount of effort.
See: http://jquery.com/ for more information.

Sean
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple selection in drop down list