tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Colebatch <...@bigpond.net.au>
Subject Re: expression tag in JSP standar
Date Tue, 24 Jul 2001 22:05:06 GMT
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.
> 


Mime
View raw message