0 Replies Latest reply on Jun 25, 2004 3:10 PM by pkavanagh

    Problem with nulls/JSPWriter when migrating from WL 5.1 to T

    pkavanagh

      Hi guys,

      we're in the process of migrating a web app from Weblogic 5.1 to JBoss 3.2.3/Tomcat 4.1.29 and we've come across an issue caused by a change in the JSPWriter between the JSP 1.1 and JSP 1.2 specifications. We need to support both app servers.

      Here's the issue: on Weblogic 5.1, the JSPWriter will implicitly convert nulls to "", whereas in Tomcat the nulls are not getting converted and we see "null" in our textfields.

      This is as expected in Tomcat 4, since according to the JSP 1.2 spec:

      public abstract void print(java.lang.String s)
       throws java.io.IOException
      Print a string. If the argument is null then the string "null" is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the Writer.write(int) method.


      The same behavior is described in the JSP 2.0 spec and is seen as expected in Tomcat 5.

      Here are our options as I see them:

      1. write some Javascript to go through the DOM after each page loads and replace null values in text components with ""
      2. modify every JSP (we have ~450) to print "" if a string is null
      3. hack Tomcat's JSPWriter to print "" if a string is null

      Our current thinking is to do #3 first in order to get something working asap, and to do #2 in parallel and as a long term solution.

      Any better suggestions ? Is there any configuration setting in Tomcat that would give implicitly convert nulls to empty strings in the JSPWriter.print(String s) method ? I've searched these forums, the tomcat-user mailing list and googled but haven't found anything.

      Thanks in advance,
      -Paul Kavanagh
      SuccessFactors Inc.