*
The moose likes Struts and the fly likes How to used Options Tag in Struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to used Options Tag in Struts?" Watch "How to used Options Tag in Struts?" New topic
Author

How to used Options Tag in Struts?

Balaji Munuswamy
Ranch Hand

Joined: Apr 07, 2002
Posts: 37
Hi ,
I have a Bean Class with List varibale and Getter and setter Method. The Code given below
public class ListBoxClass extends ActionForm {
private java.util.List TYPE_CDE;
public java.util.List getTYPE_CDE() {
return TYPE_CDE;
}
public void setTYPE_CDE(java.util.List newTYPE_CDE) {
TYPE_CDE = newTYPE_CDE;
}
}
List contain option Bean Class :-
public class OptionBean extends ActionForm {
private java.lang.String Name;
private java.lang.String Value;
public java.lang.String getName() {
return Name;
}
public java.lang.String getValue() {
return Value;
}
public void setName(java.lang.String newName) {
Name = newName;
}
public void setValue(java.lang.String newValue) {
Value = newValue;
}
}
In my Jsp,I have to use Options Tag and Display the List Box.How to Do this?
Pls Help me to solve this problem
Thanks
Balaji.M
Matthew Marquand
Ranch Hand

Joined: Dec 19, 2002
Posts: 32
Please review the html ptionsCollection tag and while you're at it look at the struts-defined LabelValueBean. You might want to create instances of that object inside your list and get rid of you name/value pair object.
Your form just needs the getter to return to List and your JSP (inside a html:select) just refers to the property.

Good Luck.
 
Don't get me started about those stupid light bulbs.
 
subject: How to used Options Tag in Struts?
 
Similar Threads
ActionForm Does Not Pick Up the Values of the Selected Check Boxes
Using EL to generate attribute/value pairs inside of an XHTML element
Collection Merging not happening
Display Check Boxes & Dropdowns in Struts with search results
using logic:iterate tag to access ActionForm elements