Thanks.  I wish Damon Hougland and Aaron Tavistock knew that before they
published their Sun sanctioned book.  It would have saved me a lot of
frustration.  I really expected Sun's CORE books to be better then Wrox.

Their example was this which failed:

<% switch (day) { %>
<% case 1: %>
   <font color="blue" size="+1">Sunday</font>
   <% break; %>
<% case 2: %>
   <font color="blue" size="+1">Monday</font>
   <% break; %>
<% default: %>
   <font color="blue" size="+1">No day</font>
   <% break; %>
<% } %>

If you want to use a switch, this should work:


<% switch (day) {
   case 1: %>
   <font color="blue" size="+1">Sunday</font>
   <% break; %>
<% case 2: %>
   <font color="blue" size="+1">Monday</font>
   <% break; %>
<% default: %>
   <font color="blue" size="+1">No day</font>
   <% break; } %>

But really, the best way to do it is to use JSTL instead of scriptlets like this:

<c:choose>
  <c:when test="${day == 1}">
    <font color="blue" size="+1">Sunday</font>
  </c:when>
  <c:when test="${day == 2}">
    <font color="blue" size="+1">Monday</font>
  </c:when>
  <c:otherwise>
    <font color="blue" size="+1">No day</font>
  </c:otherwise>
</c:choose>

Much more readable, too.

-Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to