如何在JsTL中比较Map键和List

时间:2015-08-23 16:13:10

标签: java web-services jsp jstl

我已尝试查看有关同一问题的许多其他类似问题,但我无法解决。

我正在尝试将地图的密钥与JSONObject的名称进行比较,但它给出了以下错误,

SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/RailTickets] threw exception [/WEB-INF/views/trainsbetween.jsp (line: 13, column: 58) equal symbol expected] with root cause
org.apache.jasper.JasperException: /WEB-INF/views/trainsbetween.jsp (line: 13, column: 58) equal symbol expected
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:89)
    at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:217)
    at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:162)
    at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:153)
    at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1236)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1452)
    at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1664)
    at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1002)
    at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1274)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1452)
    at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1664)
    at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1002)
    at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1274)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1452)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:266)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1225)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1012)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

这是我写的代码,

<body>
<c:forEach var="resultValue" items="${seatMap}">
<c:forEach var="trainValue" items="${trainList}">
<c:if test="${resultValue.key} == ${trainValue.get("number")}">
<div>
${trainValue.get("no")}
${trainValue.get("number")}
${trainValue.get("name")}
${trainValue.get("from").get("name")}
<br><br><br>
</div>
</c:if>
</c:forEach>
</c:forEach>
</body>

这里的seatMap是map<String,List<JSONObject>,trainList是List<JSONObject>

第13行是<c:if test="${resultValue.key} == ${trainValue.get("number")}">

请帮帮我。

0 个答案:

没有答案