tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Hester" <hesterl...@hotmail.com>
Subject Re: What's the problem with Tomcat 4.1.29 and Switch?
Date Tue, 24 Feb 2004 03:22:40 GMT
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; %>
<% } %>

-- 
George Hester
__________________________________
"Carl Howells" <chowells@janrain.com> wrote in message news:403ABEAA.7020007@janrain.com...
> Because the switch statement has different syntax.
> 
>    <% switch (day) { %>
>     <% case 1: // and so on...
>    %>
> 
> Could be translated to:
>    switch (day) {
>    out.print("\n ");
>    case 1: // and so on...
> 
> Which is clearly illegal syntax.  There is no equivalent illegal form of 
> any other block construct, which is why this only shows up with switch 
> statements.
> 
> George Hester wrote:
> > Well according to Core JSP by Damon Hougland and Aaron Tavistock © 2001 Prentice
Hall (pgs 26-28) it should work.
> > 
> > For example this works:
> > 
> >   <% if (day == 1 | day == 7){ %>
> >    <font color="red" size="+1">
> >    It's the weekend!</font>
> >   <% } else { %>
> >    <font color="red" size="+1">
> >    Still in the work week.</font>
> >   <% } %>
> > 
> > then why not the same for the switch?  Note if breaking these tags up for the if
- then - else (as shown above) like in the switch I showed you then by transference we'd have
to conclude that the above if - then - else wouldn't work either.  But it does.
> > 
> > So I'm confused.  Why can we break the tags up in if - then - else but not in switch?
> > 
> > hmmm...
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message