struts2 select标签
headerValue : 默认值value headerKey : 默认name list : 源数据 (可以在action方法里从数据库获取list) name : 被选数据存放的位置(这里我方在对象obj的属性值userName中<需在action中定义该对象>) listKey : 下拉选项的name listValue : 下拉选项的value value : 默认值 1.第一个例子: <s:select list="{'aa','bb','cc'}" theme="simple" headerKey="00" headerValue="00"></s:select> 2.第二个例子: <s:select list="#{1:'aa',2:'bb',3:'cc'}" label="abc" listKey="key" listValue="value" headerKey="0" headerValue="aabb"> 3.第三个例子: <% java.util.HashMap map = new java.util.LinkedHashMap(); map.put(1,"aaa"); map.put(2,"bbb"); map.put(3,"ccc"); request.setAttribute("map",map); request.setAttribute("aa","2"); %> <s:select list="#request.map" label="abc" listKey="key" listValue="value" value="#request.aa" headerKey="0" headerValue="aabb"></ s:select > headerKey headerValue 为设置缺省值 4.第四个例子 public class Program implements Serializable { /** serialVersionUID */ private static final long serialVersionUID = 1L; private int programid; private String programName; public int getProgramid() { return programid; } public void setProgramid(int programid) { this.programid = programid; } public String getProgramName() { return programName; } public void setProgramName(String programName) { this.programName = programName; } }