• 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

Help for html:option tag

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic