> options:
> define null as empty string  e.g.
> String null = "";

null is a reserved word in java, you can't redfine it.


> OR
> change compare to == ""
> 

??

if (null == rs.getString("col_foo"))
works just fine.

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html#getString(int)

Returns:
    the column value; if the value is SQL NULL, the value returned is null 


> HTH
> M--
> This email message and any files transmitted with it contain
> confidential information intended only for the person(s) to whom this
> email message is addressed.  If you have received this email message
> in error, please notify the sender immediately by telephone or email
> and destroy the original message without making a copy.  Thank you.
> 
> ----- Original Message ----- 
> From: "Tim Funk" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <users@tomcat.apache.org>
> Sent: Thursday, June 21, 2007 7:24 AM
> Subject: Re: Null
> 
> 
> > The syntax below is correct. There must be something else
> > syntactically incorrect in your jsp causing your woes.
> >
> > -Tim
> >
> > Mohammed Zabin wrote:
> >> I tried it the other way, if( rs.getString("field") == null ) but
> >> the compiler plames that null can't be compared to string....
> >>
> >> On 6/21/07, Tim Funk <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>> if (null == rs.getString("col_foo")) {
> >>>    out.println("<td>&nbsp;</td>");
> >>> } else {
> >>>    // Evil since this doesn't escape the xml - for edutainment
> >>>    only out.println("<td>" + rs.getString("col_foo") + "</td>");
> >>> }
> >>>
> >>> -Tim
> >>>
> >>> Mohammed Zabin wrote:
> >>> > Hi All
> >>> >
> >>> > Anyone knows how to deal with null values in JDBC ResultSet??
> >>> >
> >>> > I am trying to render a table in jsp page that read its value
> >>> > from the database, sometimes, the database returns null values,
> >>> > and so, the
> >>> whole
> >>> > table couldn't be rendered. Is there any way to deal with null
> >>> > values.
> >>> >
> >
> > --------------------------------------------------------------------
> > - To start a new topic, e-mail: users@tomcat.apache.org To
> > unsubscribe, e-mail: [EMAIL PROTECTED] For
> > additional commands, e-mail: [EMAIL PROTECTED]
> >
> > 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
> e-mail: [EMAIL PROTECTED] For additional commands,
> e-mail: [EMAIL PROTECTED]
> 



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to