Struts html:options 标签
来源:互联网 发布:淘宝上靠谱的代购店 编辑:程序博客网 时间:2024/06/08 08:35
使用Collection来给html:options 标签的collection属性赋值
<html:select property="userId">
<html:option value="">all</html:option>
<html:options collection="${userlist}" property="userID"
labelProperty="userName" />
</html:select>
userlist 通过以下语句赋值
<c:set var="userlist" value="${springctx.userAccountService.userAccounts}"/>
userlist为一存放有UserAccount对象的list。userID,userName为UserAccount对象的属性。
property="userID" 指 以collection指定的对象里每个元素的userID做为options 的property。
labelProperty="userName" 指collection指定的对象里每个元素的userName做为options 的labelProperty。
------------------------------------------------------
使用Map来为html:options 标签的collection属性赋值
<html:select property="userId">
<html:option value="">all</html:option>
<html:options collection="userNameMap" property="key" labelProperty="value" />
</html:select>
userNameMap 为一以UserAccount对象的userID属性为key,userName属性为value的map。
property="key" 意思指 以collection属性指定的map的key值做为option 的property。
labelProperty="value" 意思是以collection属性指定的map的value值(对应property="key" )做为option 的 labelProperty。
--------------------------------------------------------
以上两种方法均可达到以集合中所有UserAccount对象的userID属性作为property,userName属性为labelProperty的效果。
- Struts html:options 标签
- struts中html:options标签的使用
- Struts html 标签:checkbox multibox ridio select option options optionsCollection
- struts html options collection
- struts中html:select标签和html:options 的使用(转)
- html:options标签与html:optionCollectoin标签
- html:select,html:option,html:options标签
- Struts标签-html标签
- Struts中html:options的使用
- struts中html:options的使用
- Struts中html:options的使用
- Struts 中 html:options 的使用
- Struts中html:options的使用
- Struts中html:options的使用
- [****]Struts 中 html:options 的使用
- Struts中html:options的使用
- Struts 中 html:options 的使用
- Struts中html:options的使用
- A simple config.xml of Cruise Control
- http 411错误
- P2P软件工作原理
- jstl ct:call 调用bean的函数
- DPL,RPL,CPL 之间的联系和区别
- Struts html:options 标签
- ssh的X11window
- ArrayList类的ToArray()使用注意点
- Windows下实现程序单一运行
- iPhone开发学习笔记 - 目录
- dwr使用
- 超级详细找CALL写CALL教程
- JavaScrit中class的写法
- Web Service:Apache CXF简单例子