Multiple <c: when> inside <c: select>

I'm just wondering if the code below is really?

<c:choose> <c:when test="${empty example1}"> </c:when> <c:when test="${empty example2}"> </c:when> <c:otherwise> </c:otherwise> </c:choose> 
+7
source share
3 answers

In c:choose , the first one for which this test is true is the winner. In c:choose below, if the "first test" and "second test" are both true, then "Kpow" h2 ​​will be added to the html page, but "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> 
+30
source
 <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; } 
+4
source

Yes, its valid. Why not just give it a try? See JSTL for more information.

+1
source

All Articles