You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by wa...@technologist.com on 2001/07/24 20:15:33 UTC
expression tag in JSP standar
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.
Re: expression tag in JSP standar
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Wed, 25 Jul 2001, Jim Cheesman wrote:
> 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.)
>
Jim's analysis is correct. And the JSP 1.2 spec (now in Proposed Final
Draft 3 state) says exactly the same thing.
If you feel that the spec *should* say something about this, the best
avenue is to address your suggestion to the appropriate feedback address
<js...@eng.sun.com> for consideration by the expert group.
By the way, the corresponding address for the servlet spec is
<se...@eng.sun.com>.
Craig McClanahan
Re: expression tag in JSP standar
Posted by Jim Cheesman <jc...@msl.es>.
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.
Re: expression tag in JSP standar
Posted by Dmitri Colebatch <di...@bigpond.net.au>.
Given that Tomcat is the reference implementation I would assume its
implementation is the correct one.
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.
>