I agree entirely. But does the Struts model or some kind of disciplined
taglib approach suck as much? Obviously, it still keeps all the JSP problems
lurking as possibilities. But I find the whole "server page" idea very
strong among developers and clients and the taglib approach seems to be a
bridge to a better separation of content and code. You've all probably been
through this discussion but I'd like to know your thoughts.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jon Stevens
Sent: Tuesday, February 20, 2001 2:36 PM
To: Turbine
Subject: JSP


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]



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to