*
The moose likes Struts and the fly likes Dynamic Drop Down Lists in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamic Drop Down Lists in Struts" Watch "Dynamic Drop Down Lists in Struts" New topic
Author

Dynamic Drop Down Lists in Struts

Harrry Singh
Greenhorn

Joined: Mar 13, 2012
Posts: 4
Hi,

I've got two drop down lists in struts. The value of second one is dependent on first one selected. Basically the first one is type of location(location Group) and the second one is a list of locations based on the type selected. I already have request variables for locations that I can use for second drop down, but the problem is how can I dynamically display locations list based on selection in first drop downlist.

I've got this in my request already



so basically how to display the second drop down based on type selected from LocationGroup Set (which is displayed in first drop down).

I know I can use Ajax, but then my request variables will not be available in AJAX methods.

Thanks in advance.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Have you looked at the DoubleSelect tag?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
G.S. Chaudhary
Greenhorn

Joined: Mar 26, 2012
Posts: 1
1. Add onChange=generateSecondSelectBoxValues(this.value) attribute to the Ist selectBox.
2. Perform ajax operations for that selected value
3. via Ajax fill the 2nd selectedBox

Done!! :-)

using doubleSelect component in case of dynamically large values would be hectic.
Harrry Singh
Greenhorn

Joined: Mar 13, 2012
Posts: 4
G.S. Chaudhary wrote:1. Add onChange=generateSecondSelectBoxValues(this.value) attribute to the Ist selectBox.
2. Perform ajax operations for that selected value
3. via Ajax fill the 2nd selectedBox

Done!! :-)

using doubleSelect component in case of dynamically large values would be hectic.


Yes this is what I'm thinking as well, but then I will loose my request variables if I sent Ajax request.

Joe Ess wrote:Have you looked at the DoubleSelect tag?


I don't think I can use Double Select tag as I'm using struts 1.3.5 and not struts 2.
Harrry Singh
Greenhorn

Joined: Mar 13, 2012
Posts: 4
anyone please.
 
 
subject: Dynamic Drop Down Lists in Struts
 
Similar Threads
Dynamic populating the drop down list based on the selected value of first list
Spring MVC - A novice doubt
Dynamic Drop Down Lists.
How to retrieve data from database when ever select in drop down list?
Passing field information