Struts如何显示<html:option>
大家好,
假如
我有一个javabean类
User.java
public class User{
public int id;
public String username;
public String password;
....
}
jsp页面
<%
Collection col=new ArrayList();
for(int i=0;i <10;i++){
col.add(new User());
}
request.setAttribute( "users ",col);
....
%>
<html:select property= "??? ">
<logic:iterate name= "users " id= "user ">
<html:option value= "用户的id "> 用户名 </html:option>
</logic:iterate>
</html:select>
....
----------------------------
要实现以上功能,请指点怎么用logic标签和html标签迭代出来这个集合
谢谢
------解决方案-------------------- <html:select property= "id ">
<html:options collection= "users " property= "id " labelProperty= "username "/>
</html:select>
------解决方案-------------------- <html:select property= "id ">
<logic:iterate id= "user " name= "users ">
<bean:define id= "op " name= "user " property= "userId " />
<html:option value= " <%=(String)op%> "> <bean:write name= "user " property= "username "/> </html:option>
</logic:iterate>
</html>