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.
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.
Joined: Jul 12, 2002
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.
subject: populating list boxes in forms - help required