Bill,
You have to ensure that some valid data (perhaps an empty string) is
returned by the get<Property> method of
the bean. JSP automatically attempts to turn the returned object to a
string in order to print it out (after
all, the content of your page is essentially being written as text to an
output stream). If a null is returned,
the attempt to print (or add to the remainder of the surrounding text in
order to print) causes the null pointer
exception.
-AMT
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Bill Lynch
> Sent: Thursday, January 06, 2000 1:22 PM
> To: [EMAIL PROTECTED]
> Subject: <jsp:getProperty/> and returning null
>
>
> Does anyone know how to return null values in a bean (or how to handle
> them gracefully). I'm using a bean that queries a database and some of the
> records may be null. however when i do:
>
> <jsp:getProperty ... />
>
> and it returns a null value from the specified property, I get a 'null
> pointer exception.'
>
> Thanks in advance,
> --Bill
>
>
> Bill Lynch -- [EMAIL PROTECTED]
> 4charity.com -- http://www.4charity.com
> University of Iowa -- http://www.cs.uiowa.edu/~bmlynch
> CoolServlets.com -- http://www.coolservlets.com
> ----------------------------------------------------------
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html