structs中通过LabelValueBean构建下拉列表

Action类中增加列表
 List<LabelValueBean> list = new ArrayList<LabelValueBean>();
list.add(new LabelValueBean("选项1","1"));
list.add(new LabelValueBean("选项2","2"));
list.add(new LabelValueBean("选项3","3"));
request.setAttribute("test",list);
jsp页面中引入struts标签<%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html" %>
 <html:form action="/groupAction">
  <html:select property="county_no">
    <html:optionsCollection name="test" />
  </html:select>
</html:form>

posted on 2014-04-22 20:03  佬叁  阅读(372)  评论(0编辑  收藏  举报

导航