• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Query in Struts

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I would like to post the following query.
I am a beginner of Struts.
I use <html:select> and populate it with values from an arraylist.Now my question is :
on selecting a value(an option) from the combo,I want a second combo to be populated on the basis of what was selected in the first.
Maybe,I will make it more clearer below:
For eg:
Suppose I have an array list of states of the US in the first combo.In the second combo,on selecting a state,lets say Washington,I want to populate the second combo with counties of Washington only.
Can anyone send me some code?
Advance Thanks ....
Have a nice day.

 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Syscom DL,
We don't have many rules at Javaranch, but our display name policy is one of them. Please read this policy and change your display name to comply with it if you wish to continue posting. Thanks.
You can change your display name here.
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are wanting the population to take place without a trip to the server, what you are talking about is a JavaScript problem. Doing things like this normally requires multiple javascript arrays. When the first pulldown is selected, JavaScript dynamically populates the second pulldown. In a case like this you may not want to keep an array containing all the states, and fifty more arrays for all the counties in each state. But if you do want to do that, the helpful people in the HTML/JavaScript forum live and breathe to solve these very sorts of problems.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vinoo,
You may want to re-read the display name policy because your new display name does not comply either.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Based on what you PM'd me, you would have to submit the form and populate another collection for the second dropdown based on the selection in the first dropdown. Some JavaScript can be done to have the form submitted when the state is selected.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic