File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Help for html:option tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help for html:option tag" Watch "Help for html:option tag" New topic

Help for html:option tag

mitesh mehta

Joined: Aug 29, 2002
Posts: 25
i am absolutely new to the Struts framework...
what i want is a basic application showing the values in the Combo from database.
I have made the following code for the jsp page:-
<html:select property="status">
<html ption collection = "categoryList" /> </html:select>
Now i am also coding the setter and getter method for property "status" which returns the String in the form class.
what changes i have to make in the action class to make it return the collection.
Any help will be appreciated in advance.
Thanking you
Lakshmanan NS

Joined: Apr 02, 2003
Posts: 20
Hi, Here is a sample.
<html:select property="teamParentId" >
<html ptions name="idList" labelName="labelList"/>
Here, teamParentId is a form variable. the Form has a getter and setter for this.
idList and labelList are collection that is put into pageContext. You can bring the collection into JSP through request scope / sessions scope. In JSP you can set them in pageContext
Hope this help
mitesh mehta

Joined: Aug 29, 2002
Posts: 25
Hi Lakshman,
Thanks for the reply.I am still having a small doubt.
<html:select property="teamParentId" >
will have the corresponding getter/setter methods.
But i wanted to know where should i set the idList and labelList for the request scope?
Suppose i have a combo to display the months can you please suggest me how shld i prepare the option tag for the same?
Thanks for the help
I agree. Here's the link:
subject: Help for html:option tag
It's not a secret anymore!