This is a great example of why JSP sucks. You should NOT have to modify your
"code" to work around issues like this.
-jon
----------
From: Calin Duma <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date: Tue, 20 Feb 2001 15:35:02 -0500
To: [EMAIL PROTECTED]
Subject: Jasper question
Hello Tomcaters,
I am trying to embed a java code fragment in a jsp scriptlet. Whenever
I'm using the switch / case statements I get Jasper compilation errors:
SampleBad.jsp
-------------
<%
// A calendar object is created to get an integer value
// of the current day of the week
java.util.Calendar thisCal = java.util.Calendar.getInstance();
int day = thisCal.get(thisCal.DAY_OF_WEEK);
%>
<% switch (day) { %>
<% case 1: %>
<FONT COLOR="blue" SIZE="+1">Sunday</FONT>
<% break; %>
<% case 2: %>
<FONT COLOR="blue" SIZE="+1">Monday</FONT>
<% break; %>
<% case 3: %>
<FONT COLOR="blue" SIZE="+1">Tuesday</FONT>
<% break; %>
<% default: %>
<FONT COLOR="blue" SIZE="+1">Any other day.</FONT>
<% } %>
Extraneous out.write("\r\n") are generated and produce "Unreachable
statement" errors during the JSP compilation. I am using JBuilder 4.0
on Windows NT as my IDE (editor).
It works if I take the <CR><LF> out of the above page. Am I missing
something or is this a bug ?
SampleGood.jsp
--------------
<%
// A calendar object is created to get an integer value
// of the current day of the week
java.util.Calendar thisCal = java.util.Calendar.getInstance();
int day = thisCal.get(thisCal.DAY_OF_WEEK);
%>
<% switch (day) { %><% case 1: %>
<FONT COLOR="blue" SIZE="+1">Sunday</FONT>
<% break; %><% case 2: %>
<FONT COLOR="blue" SIZE="+1">Monday</FONT>
<% break; %><% case 3: %>
<FONT COLOR="blue" SIZE="+1">Tuesday</FONT>
<% break; %><% default: %>
<FONT COLOR="blue" SIZE="+1">Any other day.</FONT>
<% } %>
Any input would be appreciated.
Thanks,
Calin Duma
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
--
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/> && <http://java.apache.org/turbine/>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]