Bill White wrote:
>
> Hi folks:
>
>
>
> First:
>
> What is the best way to keep the word 'null' from appearing in the HTML text input
> fields on a form? I'm using JSP,
> JDBC and JavaBeans to return properties and populate the values on a form. When
> the value in the database is null,
> the word 'null' appears in the field. I'm sure I can use an 'if' statement before
> each field in my script to check
> for a null value, but is there a better way to fix this?
One way is let you bean getter methods do the checking for null instead,
and return an empty string instead of null for uninitialized properties.
Another is to use a more compact statement than an if:
<%= myBean.getFoo() == null ? "" : myBean.getFoo() %>
Yet another is to use your current bean, that returns nulls, with a utility
class that takes care of changing nulls to empty strings:
<%= StringUtils.nullToString(myBean.getFoo()) %>
> Second:
>
> I really like this forum. It is extremely helpful since very little is known
> about JSP except by those of us who are
> interested enough in it to make it work through trial and error. Is there some
> reason that this forum is not posted
> on a web site in a sort of discussion format? It would be nice to be able to search
> all the previous discussion
> threads and it might avoid repeat questions.
It is, see <http://archives.java.sun.com/archives/jsp-interest.html>
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.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