Why does this code generate the error “The end tag ”</c:when“ is unbalanced”?

梦想与她 提交于 2020-01-21 11:33:47

问题


I don't understand why I get the error:

The end tag "</c:when" is unbalanced

when this code is run:

<c:choose>
    <c:when test="${label == 'Apple'}">
        <form:form modelAttribute="fruit" action="/fruit/${fruitId}" method="post">                 
        <form:input path="fruitId" type="hidden" value="${fruitId}"/>
    </c:when>
    <c:when test="${label == 'Orange'}">
        <form:form modelAttribute="fruit" action="/fruit/${fruitId}" method="post">
        <form:input path="fruitId" type="hidden" value="${fruitId}"/>
    </c:when>               
</c:choose>

回答1:


You have an unclosed <form:form> tag.




回答2:


In my case I found that issue was using html comment syntax to comment out JSTL codes. Therefore recheck your html file which contains JSTL syntax to check you have done the same mistake. Please refer below example:

<!-- <security:authorize access="hasAnyRole('ASSOC_COMPANY','PUBLIC_COMPANY', 'INDIVIDUAL')"> -->

change above comment to below comment.

<%-- <security:authorize access="hasAnyRole('ASSOC_COMPANY','PUBLIC_COMPANY', 'INDIVIDUAL')"> --%>


来源:https://stackoverflow.com/questions/8632487/why-does-this-code-generate-the-error-the-end-tag-lt-cwhen-is-unbalanced

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!