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>
You have an unclosed
<form:form>
tag.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:
change above comment to below comment.
For me, I forgot to close a JSTL tag.
This is where should I fix
And after I changed to this it's fine.
or
Some tricks to fix this problem quickly: If you have IDEs like Netbeans, please try 1.Collapse all tags and expand one by one to see which one you did not close. 2. Type " and look at the popup menu(if you have enabled it). If there is any unclosed tag it will show up.