• 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

html:options in struts

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
I have a drop down box that contains a list of choices when a user clicks on a choice a second drop down box gets populated and the user can choose something from there.At this time the item that has been chosen in the first drop down box should be selected so the database can be populated with both the choices.My problem is i dont know how to use html ptions tag so if one could provide a comprehensive example with what all additions are to be made in the struts action class /action form and where all they have to be made it would be great.Also how i could highlight the option og the first drop down with what the user has chosen.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
options tag

<html:select property="selectedPerson">
<html ptions property="people"/>
</html:select>

ActionForm requires:
getSelectedPerson() / setSelectedPerson()
getPeople() - returns a collection

If the form has a value for selectedPerson, Struts will automatically prepopulate it as the selected option. That's mainly why we use the Struts tags - prepopulation.

The Action class... well that's your own business to do what you want with that selectedPerson value from the form.

That should be pretty comprehensive. I can answer other questions but to be any more specific I'm afraid I'd have to ask for your paycheck.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic