java.lang.NoSuchMethodException: java.util.ArrayList.get(java.lang.Long)
java.lang.NoSuchMethodException: java.util.ArrayList.get(java.lang.Long)
这个 EL 表达式:
${ModelHelper:adults(dossier).get(0).creationDate}
抛出以下异常:
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jspbo/users/dossier-list-paginee.jsp at line 52
49: <c:forEach var="dossier" items="${dossiers}">
50: <tr>
51: <td><a href="/lottery/bo/dossier/${dossier.id}/summary" class="capit">${dossier.id}</a></td>
52: <td data-title="'Création'">${ModelHelper:adults(dossier).get(0).creationDate}</td>
53: <td data-title="'MAJ'">${ModelHelper:adults(dossier).get(0).updateDate}</td>
54: <td data-title="'Principal'">
55: <a href="/lottery/bo/dossier/${dossier.id}/summary" class="capit">
java.lang.NoSuchMethodException: java.util.ArrayList.get(java.lang.Long)
java.lang.Class.getMethod(Class.java:1773)
javax.el.BeanELResolver.invoke(BeanELResolver.java:435)
org.apache.jasper.el.JasperELResolver.invoke(JasperELResolver.java:139)
org.apache.el.parser.AstValue.getValue(AstValue.java:173)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:944)
org.apache.jsp.WEB_002dINF.jspbo.users.dossier_002dlist_002dpaginee_jsp._jspx_meth_c_005fforEach_005f0(dossier_002dlist_002dpaginee_jsp.java:400)
org.apache.jsp.WEB_002dINF.jspbo.users.dossier_002dlist_002dpaginee_jsp._jspService(dossier_002dlist_002dpaginee_jsp.java:276)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
com.franceservice.controllers.bo.DossierListController.getAllDossiers(DossierListController.java:258)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:483)
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.invoke(ResourceMethodInvocationHandlerFactory.java:81)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.run(AbstractJavaResourceMethodDispatcher.java:151)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:172)
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:136)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:384)
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:342)
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
org.glassfish.jersey.server.ServerRuntime.run(ServerRuntime.java:303)
org.glassfish.jersey.internal.Errors.call(Errors.java:271)
org.glassfish.jersey.internal.Errors.call(Errors.java:267)
org.glassfish.jersey.internal.Errors.process(Errors.java:315)
org.glassfish.jersey.internal.Errors.process(Errors.java:297)
org.glassfish.jersey.internal.Errors.process(Errors.java:267)
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:316)
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:286)
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1073)
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:377)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
这是怎么造成的,我该如何解决?
在表达式语言中,像 [=10=]
这样的非十进制数字被隐式解释为 Long
。
为了通过 EL 中的固定索引访问 List
项目,您需要大括号符号 []
而不是对 List#get(int)
.[=17 执行直接方法调用=]
${ModelHelper:adults(dossier)[0].creationDate}
另请参阅:
这个 EL 表达式:
${ModelHelper:adults(dossier).get(0).creationDate}
抛出以下异常:
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jspbo/users/dossier-list-paginee.jsp at line 52
49: <c:forEach var="dossier" items="${dossiers}">
50: <tr>
51: <td><a href="/lottery/bo/dossier/${dossier.id}/summary" class="capit">${dossier.id}</a></td>
52: <td data-title="'Création'">${ModelHelper:adults(dossier).get(0).creationDate}</td>
53: <td data-title="'MAJ'">${ModelHelper:adults(dossier).get(0).updateDate}</td>
54: <td data-title="'Principal'">
55: <a href="/lottery/bo/dossier/${dossier.id}/summary" class="capit">
java.lang.NoSuchMethodException: java.util.ArrayList.get(java.lang.Long)
java.lang.Class.getMethod(Class.java:1773)
javax.el.BeanELResolver.invoke(BeanELResolver.java:435)
org.apache.jasper.el.JasperELResolver.invoke(JasperELResolver.java:139)
org.apache.el.parser.AstValue.getValue(AstValue.java:173)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:944)
org.apache.jsp.WEB_002dINF.jspbo.users.dossier_002dlist_002dpaginee_jsp._jspx_meth_c_005fforEach_005f0(dossier_002dlist_002dpaginee_jsp.java:400)
org.apache.jsp.WEB_002dINF.jspbo.users.dossier_002dlist_002dpaginee_jsp._jspService(dossier_002dlist_002dpaginee_jsp.java:276)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
com.franceservice.controllers.bo.DossierListController.getAllDossiers(DossierListController.java:258)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:483)
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.invoke(ResourceMethodInvocationHandlerFactory.java:81)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.run(AbstractJavaResourceMethodDispatcher.java:151)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:172)
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:136)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:384)
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:342)
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
org.glassfish.jersey.server.ServerRuntime.run(ServerRuntime.java:303)
org.glassfish.jersey.internal.Errors.call(Errors.java:271)
org.glassfish.jersey.internal.Errors.call(Errors.java:267)
org.glassfish.jersey.internal.Errors.process(Errors.java:315)
org.glassfish.jersey.internal.Errors.process(Errors.java:297)
org.glassfish.jersey.internal.Errors.process(Errors.java:267)
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:316)
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:286)
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1073)
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:377)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
这是怎么造成的,我该如何解决?
在表达式语言中,像 [=10=]
这样的非十进制数字被隐式解释为 Long
。
为了通过 EL 中的固定索引访问 List
项目,您需要大括号符号 []
而不是对 List#get(int)
.[=17 执行直接方法调用=]
${ModelHelper:adults(dossier)[0].creationDate}