读书人

lt;html:options/gt;的有关问题

发布时间: 2012-01-10 21:26:50 作者: rapoo

<html:options/>的问题
各位师兄师姐!给个<html:options/>的应用的简单源码给我看看,尽量详细点
我搞了好久 都搞不透
<td><html:select property="leader" name="departmentFormyzb" style="width:150" >
<html:options collection="leaders"  property="id" labelProperty="name"/>
   </html:select>

[解决办法]
<html:select property="personnelId">
<html:option value="">请选择</html:option>
<html:options collection="personList" property="personId" labelProperty="personName"/>
</html:select>
html:options自动帮你迭代personList中的内容,前提是personList是Collection类型的,
而且封装的是一个包含personId,personName属性的对象
property显示的是value,labelProperty显示的是页面看到的内容

读书人网 >Java Web开发

热点推荐