• 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

populating list boxes in forms - help required

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everybody,
I am new to the struts framework, so please bear with me. I am trying to create a struts form which has select boxes which are populated from the values coming from the database. Correct me if I am wrong: i can do this by having the previous action to put a class in request which has vectors filled with the required values, but then how do i retrive from these vectors to display things in my jsp and form the selects.
 
tumbleweed and gunslinger
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If these list boxes are for a single form, then populate the FormBean with a method of type LabelValueBean. The select then recognizes this (or any object array) to populate a typical SELECT.
Google on "LabelValueBean" for multiple code examples of exactly what you are trying to do.
If you are implying that you have vectors or something else that stays in session, you should be able to use the same logic to populate the SELECT.
 
Ahsan Hadi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many Thanks for your reply.
I did find some references on LabelValueBean on Google but no code example, perhaps you can point me to a resource. What I am trying to do:
Have JSP display which has some columns with select boxes, populated from the database. At the moment, the previous action to this jsp page is putting some vectors in request and below is how I am constructing the select:
<html:select name="fcst" property="strType">
<html ptions collection="type" property="value" labelProperty="label"/>
</html:select>
The values will submitted to a single form, please advise if the approach is correct.
thanks,
Ahsan.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic