问题
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