JSTL问题结账标签必须与已打开的标签匹配?

时间:2014-06-26 00:53:17

标签: jsp foreach jstl

从以下代码接收标题错误,但不知道为什么会这样做?

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<c:if test="${fn:length(art.articles.GALLERY) > 0}">
  <div id="slidewrapper">
    <c:set var="additionalJS" scope="request"/>${additionalJS}
      <script language="javascript">
      // global variables and arrays
      var slideShowImages    = new Array;
      var slideShowImageAlts = new Array;

      <c:set var="galleryArray" value="${art.articles.GALLERY}"/>
      <c:set var="galleryLength" value="${fn:length(art.articles.GALLERY)}"/>

      <c:forEach items="${galleryArray}" varStatus="status">

        <%-- Reverse the order --%>
        <c:set var="article" value="${galleryArray[galleryLength - status.count]}">

        <c:if test="${status.first && not empty article.img.IMAGE.filename}">
          <c:set var="firstSlide" value="${av.imageURL}${article.img.IMAGE.relative_url}/${article.img.IMAGE.filename}"/>
          <c:set var="firstAlt" value="${article.img.IMAGE.alt_text}"/>
        </c:if>

        <c:if test="${status.count == 2 && not empty article.img.IMAGE.filename}">
            <c:set var="secondSlide" value="${av.imageURL}${article.img.IMAGE.relative_url}/${article.img.IMAGE.filename}"/>
        </c:if>

        <c:if test="${not empty article.img.IMAGE.filename}">
            slideShowImages[${status.index}] = '${av.imageURL}${article.img.IMAGE.relative_url}/${article.img.IMAGE.filename}';
            slideShowImageAlts[${status.index}] = '${article.img.IMAGE.alt_text}';

            var galleryImage${status.index} = new Image();
            galleryImage${status.index}.src = '${av.imageURL}${article.img.IMAGE.relative_url}/${article.img.IMAGE.filename}';
        </c:if>
      </c:forEach>
      </script>
    </c:set>
    <div id="slidealt" <c:if test="${empty firstAlt}" > class="transparent"</c:if>>${firstAlt}</div>
    <div class="slideimage" id="imageLayer1"><img src="${firstSlide}" id="slideImage1" /></div>
    <div class="slideimage transparent" id="imageLayer2"><img src="${secondSlide}" id="slideImage2" /></div>
  </div>
  <div id="slidecontrols">
    <c:forEach items="${art.articles.GALLERY}" var="article" varStatus="status">
      <c:if test="${status.first}">
        <a href="#" onclick="zrSlideShowLogic(imageNumber - 1); return false;" id="previousButton" class="slideprevious" title="Previous">Previous</a>
      </c:if>
      <a href="#" onclick="zrSlideShowLogic(${status.index}); return false;" id="galleryPage_${status.count}" <c:if test="${status.first}">class="slidecontrolsactive"</c:if>>${status.count}</a>
      <c:if test="${status.last}">
        <a href="#" onclick="zrSlideShowLogic(imageNumber + 1); return false;" id="nextButton"  class="slidenext" title="Next">next</a>
      </c:if>
    </c:forEach>
    <div class="clear"></div>
  </div>
</c:if>

完整错误是:

ProcessRequest - url=/dealer-locator/store-detail.jsp. Exception message: .renderPage(): /includes/gallery.jsp:33: expected at . Closing tags must match opened tags. 31: galleryImage${status.index}.src = '${av.imageURL}${article.img.IMAGE.relative_url}/${article.img.IMAGE.filename}'; 32: 33: 34: 35: 

1 个答案:

答案 0 :(得分:0)

哇,忘了关闭这个

<c:set var="article" value="${galleryArray[galleryLength - status.count]}"/>