以下Treemap
是我传递的数据库中的所有值
Map<String, String> treeMap = new TreeMap<String, String>(map);
Iterator mapIterator = mapSet.iterator();
while (mapIterator.hasNext()) {
Map.Entry mapEntry = (Map.Entry) mapIterator.next();
String keyValue = (String) mapEntry.getKey();
String value = (String) mapEntry.getValue();
System.out.println("Key : " + keyValue + "= Value : " + value);
}
request.setAttribute("airline_name", treeMap);
在 JSP 页面中:
<html:select property="airline_name_value" styleId = "tempId" >
<html:options collection="airline_name" property="key" labelProperty="key" />
</html:select>
在ActionForm
:
private String airline_name;
public String getAirline_name() {
return airline_name;
}
public void setAirline_name(String airline_name) {
this.airline_name = airline_name;
}
错误:
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean under name airline_name
有没有其他方法可以使用html:options
收藏标签?