struts2中select标签发生错误,没有找到解决方法
我在jsp页面上用select标签,但是它报了个错“org.apache.jasper.JasperException:tag'select',field'list',n...
我在jsp页面上用select标签,但是它报了个错“org.apache.jasper.JasperException: tag 'select', field 'list', name 'sectionId': The requested list key 'section' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]”但是不知道怎么解决,请各位高手帮帮忙!!! 页面上是这样的“
展开
展开全部
初步判断是你返回给select标签的list不符合标签的数据格式.参考一下吧:
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.第三个例子:
<%
HashMap map = new 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>
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.第三个例子:
<%
HashMap map = new 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>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询