报错(Illegal use of <when>-style tag without <choose> as its direct parent)

报错描述:javax.servlet.jsp.JspTagException: Illegal use of <when>-style tag without <choose> as its direct parent
分析发现:
使用jstl标签: 和 时必须同时使用使用
例如:

<c:forEach begin="1" end="${pageBean.totalPage }" var="i">
    <c:choose> 
        <c:when test="${pageBean.pageNumber==i }">
            <li class="active"><a>${i }</a></li>
        </c:when> 
        <c:otherwise>
            <li><a href="${pageContext.request.contextPath}/ProductServlet?method=findProductByCid4Page&pageNumber=${i}&cid=${param.cid}">${i }</a></li>
        </c:otherwise> 
    </c:choose> 
</c:forEach>

版权声明:本文为fareality原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。