Summary: | Code generation of TagPlugins: When and Otherwise error when they are used without <c:choose> outside | ||
---|---|---|---|
Product: | Tomcat 7 | Reporter: | Sheldon Shao <xshao> |
Component: | Jasper | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | trunk | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Bug Depends on: | 54242 | ||
Bug Blocks: | |||
Attachments: |
Patchs for Choose When & Otherwise
Test case for Choose.java, When.java & Otherwise.java |
Created attachment 29774 [details]
Test case for Choose.java, When.java & Otherwise.java
The test case depends the helper class provided in Bug 54242. Your JSP is incorrect. You are not allowed to nest those tags that way. Did you expect that to be allowed, or you do not like how this error is handled? The JSP works very well on Jasper when without tagPlugins. However JSP can't be compiled when with those jstl TagPlugins. Here is the original tags, <c:choose> <c:when test="${iqModel.lotSize gt 0}"> <c:when test="${iqModel.remainQty eq 1}">${res:content2(res.content.global.ViewItemWeb.ItemQuantity.LmtlotAvailable, quantityContentContract)}</c:when> <c:otherwise>${res:content2(res.content.global.ViewItemWeb.ItemQuantity.LmtlotsAvailable, quantityContentContract)}</c:otherwise> </c:when> <c:otherwise>${res:content2(res.content.global.ViewItemWeb.ItemQuantity.LmtQtyTxt, quantityContentContract)}</c:otherwise> </c:choose> (In reply to comment #3) > Your JSP is incorrect. You are not allowed to nest those tags that way. > > Did you expect that to be allowed, or you do not like how this error is > handled? Sheldon, what /should/ the result be when you improperly-nest these tags? No tagPlugins the JSP works very well. With tagPlugins setup should not give compilation error even at some corner case. (In reply to comment #5) > Sheldon, what /should/ the result be when you improperly-nest these tags? The page is invalid. When and Otherwise are required to have Choose as an immediate parent. If the JSTL implementation doesn't enforce that then that isn't Tomcat's problem. |
Created attachment 29773 [details] Patchs for Choose When & Otherwise There is no "}" when "<c:when> or <c:otherwise>" are used without <c:choose> outside. For example, <c:choose> <c:when test="${true}"> When 1 <c:when test="${abc}"> When 2 </c:when> <c:otherwise> Otherwise </c:otherwise> <!-- These two tags will generate code like this "if ($abc}) {} else {", no "}" at the end" --> </c:when> </c:choose>