You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "PADALA, SANDHYA (SBCSI)" <sp...@sbc.com> on 2004/05/20 17:30:21 UTC
Html:select tag
I have to display a drop down on my JSP using html select tag. Since I
am using struts , I am using <html:select> tag. I have a Form Bean
FooForm in request scope. This form bean has array of custom defined
Action objects. My Action object is a bean with ActionID and ActionName
as the attributes. I require Actions actionName as the value for my
select option. Can someone help me with some code snippet on how to do
this.
My Form bean
public class FooForm extends ActionForm {
public Action[] actionList;
public Action[] getActionList() {
return actionList;
}
public Action getActionList(int index) {
return actionList[index];
}
public void setActionList(Action action, int index) {
this.actionList[index] = action;
}
public void setActionList(Action[] actionList) {
this.actionList = actionList;
}
}
public class Action {
public int actionId;
public String actionName;
public int getActionId()
{
return actionId;
}
public String getActionName()
{
return actionName;
}
public void setActionId(int id)
{
this.actionId = id;
}
public void setActionName(String name)
{
this.actionName = name;
}
}
On my JSP
<html:select property="actionList">
<html:options property="actionList" />
</html:select>
Thanks for your help in advance.
Sandhya
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org