jsp里:
<html:select property="userid">
<html:options collection="userHtmlSelect" property="value" labelProperty="label"/>
</html:select>
ActionForm 里:
private java.lang.String userid="admin"; //默认值
Action里:
form.setUserid("guest");//修改默认值
//设置下拉选项
List rs = new java.util.ArrayList();
rs.add(new org.apache.struts.util.LabelValueBean("管理员",
"admin"));
rs.add(new org.apache.struts.util.LabelValueBean("客人","guest"));
request.getSession().setAttribute("userHtmlSelect",rs);
return mapping.findForward("index");
Struts下拉框配置
本文介绍如何在Struts框架中使用HTML标签来创建带有默认值的下拉选择框,并展示了如何通过Action来修改默认选项及设置下拉框的数据源。
268

被折叠的 条评论
为什么被折叠?



