You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marcelo Epstein <ma...@epstein.com.br> on 2004/06/03 18:49:53 UTC

and get...()

Hi,

When I use <bean:write ...> if the value is null, the tag returns "".
But, when I try, for example, System.out.print(xxx.getProperty()) inside an Action and the property is null. It returns the String "null". 
What is the best practice to avoid printing "null" ? I have to check all values before printing? Is there a better way to do that?

Thanks in advance,
Marcelo

Re: and get...()

Posted by Bill Siggelkow <bi...@bellsouth.net>.
The reason you "System.out.print(foo.getBar())" printed "null" is 
because that is how the print method is written. If the returned value 
of the method is actually <code>null</code> then the "print" method 
prints the value "null".

Long story short, what you are seeing is result of calling 
"System.out.print" not the result of the returned property value.

Kapisch(sic?)?

Marcelo Epstein wrote:

> Hi,
> 
> When I use <bean:write ...> if the value is null, the tag returns "".
> But, when I try, for example, System.out.print(xxx.getProperty()) inside an Action and the property is null. It returns the String "null". 
> What is the best practice to avoid printing "null" ? I have to check all values before printing? Is there a better way to do that?
> 
> Thanks in advance,
> Marcelo


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org