George,
OK, I'll bite. Why?
Not sure why you want to try this but from what I understand, no it won't
work. The clue is that the jsp page is converted to a servlet and any code
between the <% %> must stand on it own as valid code. When you split the
code you have created two segments that if entered in a standard servlet
could not stand on their own IF separated at ALL. Thus if the segregation
was allowed then what would prevent you from inserting code between them?
Thus when the servlet is created you then have two fragments of invalid code
separated by other code. With that in mind, a simple test to determine if
what you want is valid is to enter whatever you want between the <% %> in a
standard class and see if it complains.
Again this is from my understanding.
Doug Parsons
www.parsonstechnical.com
----- Original Message -----
From: "George Hester" <hesterloli@hotmail.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Monday, February 23, 2004 9:03 PM
Subject: What's the problem with Tomcat 4.1.29 and Switch?
In Tomacat this works fine:
<-- switch.jsp -->
<!-- BEGIN -->
<!doctype html public "-//W3C//DTD HTML 4.0 Final//EN">
<%
int day = 3;
%>
<html>
<head>
<title>Test Switch</title>
</head>
<body>
<% switch (day) {
case 1:
out.println("Sunday");
break;
case 2:
out.println("Monday");
break;
default:
out.println("No day");
break;
} %>
</body>
</html>
<!-- END -->
but this does NOT
<-- switch.jsp -->
<!-- BEGIN -->
<!doctype html public "-//W3C//DTD HTML 4.0 Final//EN">
<%
int day = 3;
%>
<html>
<head>
<title>Test Switch</title>
</head>
<body>
<% switch (day) { %>
<% case 1:
out.println("Sunday");
break;
case 2:
out.println("Monday");
break;
default:
out.println("No day");
break;
} %>
</body>
</html>
<!-- END -->
--
George Hester
__________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org