tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <>
Subject Re: ELSE for JSTL
Date Sat, 08 Feb 2003 23:32:26 GMT
On Sat, 8 Feb 2003, Henri Yandell wrote:

> Why not:
> <c:if test="...">
>   <c:do>
>     foo
>   </c:do>
>   <c:else>
>     bar
>   </c:else>
> </c:if>
> ?? Just to make it a bit nicer in xml look and feel.
> Which of course is synonymous to choose I think :)

Yes, exactly.  The <c:choose>, <c:when>, and <c:otherwise> tags simply
provide a more generalized syntax since they allow multiple conditions.

During the JSR-52 EG's deliberations, most of the members felt that there
were definite advantages to a simple <c:if> tag unencumbered by multi-way
conditions; no matter where a <c:if> tag appears, its body is included if
'test' is true and excluded otherwise.  Either way, evaluation continues
after the closing </c:if> tag.  Particularly for large and complex pages,
this kind of simplicity -- for, after all, a task that is one of JSTL's
simplest functions -- was considered desirable.

Note also that XSLT faced an identical problem (or at least a very similar
one) and came to the same conclusions.

Shawn Bayern
"JSTL in Action"

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message