I think you can use the format:

<t:formatnull value="${contract?.manager?.address?.city?.name}" />

... where if any of the hierarchy is null is will stop trying to evaluate
methods / properties on subordinates, avoiding your NPE.

Regards,
Jim.

-----Original Message-----
From: Dmitriy Vsekhvalnov [mailto:dvsekhval...@gmail.com] 
Sent: 14 October 2010 09:01
To: users@tapestry.apache.org
Subject: Component to format null values

Hello all,

i'm looking to some approach to render property value or some default string
if value is null.

Something like:
   <t:formatnull value="contract.name" />

I have no problem to implement such component,but i want this to work with
property chains as well:

  <t:formatnull value="contract.manager.address.city.name" />

where i want default string to be rendered, if any of intermediate values
evaluated to null. Now i'm getting NPE.

Is there are any service in tapestry which i can use for property
expressions evaluation or any other ideas?

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to