wood burning stoves
The moose likes Struts and the fly likes html:options in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:options in struts" Watch "html:options in struts" New topic

html:options in struts

shawn kennedy
Ranch Hand

Joined: Oct 31, 2002
Posts: 67
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.
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

options tag

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

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.

A good workman is known by his tools.
I agree. Here's the link: http://aspose.com/file-tools
subject: html:options in struts
It's not a secret anymore!