ActionForm 里:
java 代码
jsp里:
< html:select property="userid">
< html:options collection="userHtmlSelect" property="value" labelProperty="label"/>
< /html:select>
< html:select property="userid">
< html:options collection="userHtmlSelect" property="value" labelProperty="label"/>
< /html:select>
注解:userid是Form对象的属性。
本文介绍如何在Struts2框架中通过ActionForm和Action设置默认的下拉选项值。首先定义ActionForm中的默认值,在Action中可以修改这个默认值,并设置下拉选项的集合。最后在JSP页面中使用Struts标签<html:select>和<html:options>显示这些选项。
1636

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



