• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help for html:option tag

 
mitesh mehta
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
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
Mitesh
 
Lakshmanan NS
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Here is a sample.
<html:select property="teamParentId" >
<html ptions name="idList" labelName="labelList"/>
</html:select>
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
Lakshman
 
mitesh mehta
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lakshman,
Thanks for the reply.I am still having a small doubt.
Now
<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
Mitesh
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic