http://tapestry.apache.org/tapestry5.1/guide/propexp.html
The  "safe dereference operator"

On Thu, Oct 14, 2010 at 12:03, Muhammad Mohsen <m.gelb...@gmail.com> wrote:
> Excuse me, I'm not questioning the functioning of your mentioned solution
> but where in the documentation is that ? I wanna read more about this.
> Thanks
>
> On Thu, Oct 14, 2010 at 10:21 AM, Jim O'Callaghan 
> <jc1000...@yahoo.co.uk>wrote:
>
>> 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
>>
>>
>
>
> --
> *Regards,*
> *Muhammad Gelbana
> Java Software Programmer*
>



-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

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

Reply via email to