我想发送list元素(位于我的JSP上):
${mylist}
Run Code Online (Sandbox Code Playgroud)
对于我的自定义标签mytag.tag,这是我在JSP页面中的内容:
<tags:mytag list="${mylist}" ></tagsmytag>
Run Code Online (Sandbox Code Playgroud)
但是当我这样发送它时,我无法访问它的元素,这里是mytag.tag:
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="springForm"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@attribute name="list" required="true"%>
<c:forEach items="${pageScope.list}" var="listVar">
<option value="${listVart[0]}">${listVar[1]}</option>
</c:forEach>
Run Code Online (Sandbox Code Playgroud)
后端控制器:
@ModelAttribute("mylist")
List<Permission> getAllActivePermissions(){
return permissionService.getAllActivePermissions();
}
Run Code Online (Sandbox Code Playgroud)
例外是:
javax.el.PropertyNotFoundException: Property '0' not found on type java.lang.String
at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:237)
at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:214)
at javax.el.BeanELResolver.property(BeanELResolver.java:325)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:85)
at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:104)
at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:1026)
at org.apache.jsp.tag.webmultiple_tag._jspx_meth_c_005fforEach_005f1(webmultiple_tag.java:454)
at org.apache.jsp.tag.webmultiple_tag._jspx_meth_springForm_005fselect_005f1(webmultiple_tag.java:413)
at org.apache.jsp.tag.webmultiple_tag._jspx_meth_c_005fotherwise_005f0(webmultiple_tag.java:375)
at org.apache.jsp.tag.webmultiple_tag.doTag(webmultiple_tag.java:222)
at org.apache.jsp.WEB_002dINF.pages.roles.newRole_jsp._jspx_meth_tags_005fmultiple_005f0(newRole_jsp.java:674)
at org.apache.jsp.WEB_002dINF.pages.roles.newRole_jsp._jspx_meth_springForm_005fform_005f0(newRole_jsp.java:566)
at org.apache.jsp.WEB_002dINF.pages.roles.newRole_jsp._jspService(newRole_jsp.java:378)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) …Run Code Online (Sandbox Code Playgroud)