tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Cantrell" <Mike.Cantr...@ind.alcatel.com>
Subject Re: CLOBS and the EL
Date Tue, 17 Dec 2002 18:52:55 GMT
The JSTL sql tag simply saves the ResultSet's .getObject() method and 
when you iterate through the rows, c:out calls the object's .toString() 
method. Oracle's implementation of the Clob object does not override the 
Object's .toString() method to produce the field's value. You must do 
something like:

  /**
   * Returns the Clob object as a String Object
   */
  public static String clobToString(Object clob) throws SQLException {
    if (clob != null && clob instanceof Clob) {
      long length = ((Clob)clob).length();
      return ((Clob)clob).getSubString(1, (int)length);
    }
    else {
      return null;
    }
  }


I don't think it would be very portable to do this inside the JSTL code.

Just my  ++cents



James Smith wrote:

>Hello.  I'm using the Jakarta JSTL tags (1.0.2) within Tomcat 4.1.12, with
>JDK 1.4.0 on a Windows platform.  I'm using the SQL tags to get large text
>fields from an Oracle database and Oracle sends back those fields as CLOBs,
>not as strings.  When putting the data into the pageContext, the EL decides
>that the CLOBs are not strings and therefore acts as if the CLOBs were
>beans.  Is there an easy way to get the EL to turn the CLOBs into strings
>automatically, or, if there isn't, can anyone point me to the proper .java
>file in the JSTL source code so I can jimmy with it there?  Thanks,
>
>James
>
>
>--
>To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>
>
>  
>


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message