tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Cheesman <jch...@msl.es>
Subject Re: expression tag in JSP standar
Date Wed, 25 Jul 2001 07:19:01 GMT
At 12:05 AM 25/07/01, you wrote:
>Given that Tomcat is the reference implementation I would assume its
>implementation is the correct one.


And assuming, of course, that the behaviour is defined... In the spec for 
JSP1.1 the only thing it says is that the expression is "coerced" into a 
String. What the container does with a null String is up to it. (This may 
mean that any of the types of behaviour you've seen is/are correct.)









>cheesr
>dim
>
>On Tue, 24 Jul 2001 wapeditor@technologist.com wrote:
>
> > Hi,
> >
> > I have notice a miss-implementation of the 'expression tag' ("<%= ...
> > %>") between different JSP containers witch I want to share with you to
> > clarify the standar vs. implementarion.
> >
> > The main issue is that an expression of type "<%= variable %> within a
> > JSP page prints out different strings when 'variable' is 'null'  ((variable
> > == null) is true) ('variable' is of class 'String')
> >
> > Tomcat v3.2.1 prints out the string "null", while some other JSP containers
> > (BEA Weblogic v6.0, HP Bluestone total-e-server v7.2) print out an empty
> > string (nothing).
> >
> > However an expresion of type "<%= (variable1 + variable2) %>" prints out
> > the same on every container (where both variables are 'String', and
> > variable1 is NOT null  and variable2 IS null)
> >
> > Does anyone have an opinion on what should be the correct behave for the
> > expression-tag?. Is there any missunderstanding of the JSP
> > specifications/standar?. Why the "<%= .. %>" tag behaves different on
> > different
> > containers (same jdk 1.3.0)?.
> >
> > I wonder what is the behave on other containers (iPlanet, Websphere,
> > Tomcat 4, other..). Can anyone test it and give feedback?.
> >
> >
> > Here is the code I've tested:
> >
> > ---- jsp ------
> > <% String a = null;
> >    String b = "hello world"; %>
> > <html><boby>
> > 1 -<%=a%>-<p>
> > 2 -<%=b%>-<p>
> > 3 -<%=(b + a)%>-<p>
> > </body></html>
> > --------------
> >
> > Results:
> >
> > ----- TOMCAT -----
> > 1 -null-
> > 2 -hello world-
> > 3 -hello worldnull-
> > ----- TOMCAT -----
> >
> > ----- BEA & BLUESTONE -----
> > 1 --
> > 2 -hello world-
> > 3 -hello worldnull-
> > ----- BEA & BLUESTONE -----
> > Notice line 1 is different while 2 & 3 are equal.
> >
> > Best regards
> > Bob.
> >


--

                           *   Jim Cheesman   *
             Trabajo: 
jchees@msl.es - (34)(91) 724 9200 x 2360
              I keep telling 
myself that I am a pathological
                 liar, but I am not sure if 
I believe it.



Mime
View raw message