使用jstl时候报的错

时间:2021-03-19 19:41:07
 <c:set var="list" value="<%=sw.getRecommen(request) %>"></c:set>
                  <c:if test="${not empty list}">
                  <c:forEach var="relist" items="${list}" varStatus="status">
                  <c:choose>
                  <c:when test="${status.first}">
                  <div class="liuxuemcon_a3"><a href="#"><img src="${relist.RECPICPATH }" border="0" /></a></div>
                  </c:when>
                  <!--学校推荐开始-->
                  <div class="liuxuemcon_a5">
                     <div class="liuxuemcon_a1top">
                        <div class="liuxuemcon_a1topbt bold">学校推荐</div>
                        <div class="liuxuemcon_a1topmore"><a href="#">更多</a></div>
                     </div>
                     <c:otherwise>
                     <div class="liuxuemcon_a4con">
                        <div class="liuxuemcon_a4contu">
                           <div class="liuxuemcon_a4contuphoto"> <a href="#"><img src="<%=basePath%>${relist.RECPICPATH }" border="0" /></a>
                              <div class="flvp">${relist.SA_CNAME }</div>
                           </div>
                          <div class="liuxuemcon_a4contuwz"><a href="#">${relist.TITLE }</a></div>
                       </div>
                     </div>
                      </c:otherwise>
                   </div>
                     </c:choose>
                  </c:forEach>
                  </c:if>

我感觉没错但是报了这个错不知道是什么原因
严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for c in /quanguo/study/Message.jsp</h3><p>127: Illegal text inside "c:choose" tag: "<!--学校推...".</p><p>127: Illegal text inside "c:choose" tag: "<div cl...".</p><p>127: Illegal text inside "c:choose" tag: "<div cl...".</p><p>127: Illegal text inside "c:choose" tag: "<div cl...".</p><p>127: Illegal text inside "c:choose" tag: "</div>...".</p><p>127: Illegal text inside "c:choose" tag: "<div cl...".</p><p>127: Illegal text inside "c:choose" tag: "<a href...".</p><p>127: Illegal text inside "c:choose" tag: "</a>...".</p><p>127: Illegal text inside "c:choose" tag: "</div>...".</p><p>127: Illegal text inside "c:choose" tag: "</div>...".</p><p>154: Illegal text inside "c:choose" tag: "</div>...".</p>
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:74)
at org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1835)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1781)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:183)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

3 个解决方案

#1


<!--学校推荐开始-->

把这个注释去掉看看

#2



</c:otherwise>
  </div>
  </c:choose>

这个div是不是放错位置了,应该是放在

<div class="liuxuemcon_a1topmore"><a href="#">更多</a></div>
  </div>

后面的把

#3


<c:choose>  </c:choose>  中间不能出现 <!-- -->

#1


<!--学校推荐开始-->

把这个注释去掉看看

#2



</c:otherwise>
  </div>
  </c:choose>

这个div是不是放错位置了,应该是放在

<div class="liuxuemcon_a1topmore"><a href="#">更多</a></div>
  </div>

后面的把

#3


<c:choose>  </c:choose>  中间不能出现 <!-- -->