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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to