Reputation: 2527
I am just wondering whether the below code is valid?
<c:choose>
<c:when test="${empty example1}">
</c:when>
<c:when test="${empty example2}">
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
Upvotes: 9
Views: 40803
Reputation: 38328
In a c:choose
,
the first when for which the test is true is the winner.
In the c:choose
below,
if "first test" and "second test" are both true,
then the "Kpow" h2 will be added to the html page and the "Blammy" will not.
<c:choose>
<c:when test="first test">
<h2>Kpow</h2>
</c:when>
<c:when test="second test">
<h2>Blammy</h2>
</c:when>
</c:choose>
Upvotes: 39
Reputation: 8346
<c:choose>
<c:when test="${empty example1}">
</c:when>
<c:when test="${empty example2}">
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
This code is nothing but
switch(int i){
case 1:
...
break;
case 2:
...
break;
default:
...
break;
}
Upvotes: 8