You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Siedlecki <da...@beatsystems.com> on 2013/04/12 13:14:34 UTC

How Tapestry handles null values in template

Hi. In my template I can do this...

${person.name}

if name is null, Tapestry handles that in a nice way and displays an empty string instead of thrown a null pointer exception.

if person is null however, it returns an error which means I often have to write custom getter methods in my page class to check for null person objects myself.

I'd rather tapestry just displayed an empty string in the rendered page if person or name is null to make my code cleaner.

Is is possible to do this?

Thanks folks,

Dave.

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


RE: How Tapestry handles null values in template

Posted by "Poder, Jacob" <ja...@thermofisher.com>.
You are very welcome.

See here for documentation and examples of using tapestry expression language:
http://tapestry.apache.org/property-expressions.html

Best,
Jacob


-----Original Message-----
From: David Siedlecki [mailto:david.siedlecki@beatsystems.com] 
Sent: 12. april 2013 13:28
To: Tapestry users
Subject: Re: How Tapestry handles null values in template

Thank you!!! That's bugged me for ages. Had no idea you could do that.


----- Original Message -----
From: "Jacob Poder" <ja...@thermofisher.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Friday, 12 April, 2013 12:17:26 PM
Subject: RE: How Tapestry handles null values in template

Hi,

Try ${person?.name}


Best,
Jacob

-----Original Message-----
From: David Siedlecki [mailto:david.siedlecki@beatsystems.com] 
Sent: 12. april 2013 13:15
To: users@tapestry.apache.org
Subject: How Tapestry handles null values in template

Hi. In my template I can do this...

${person.name}

if name is null, Tapestry handles that in a nice way and displays an empty string instead of thrown a null pointer exception.

if person is null however, it returns an error which means I often have to write custom getter methods in my page class to check for null person objects myself.

I'd rather tapestry just displayed an empty string in the rendered page if person or name is null to make my code cleaner.

Is is possible to do this?

Thanks folks,

Dave.

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


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

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


Re: How Tapestry handles null values in template

Posted by David Siedlecki <da...@beatsystems.com>.
Thank you!!! That's bugged me for ages. Had no idea you could do that.


----- Original Message -----
From: "Jacob Poder" <ja...@thermofisher.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Friday, 12 April, 2013 12:17:26 PM
Subject: RE: How Tapestry handles null values in template

Hi,

Try ${person?.name}


Best,
Jacob

-----Original Message-----
From: David Siedlecki [mailto:david.siedlecki@beatsystems.com] 
Sent: 12. april 2013 13:15
To: users@tapestry.apache.org
Subject: How Tapestry handles null values in template

Hi. In my template I can do this...

${person.name}

if name is null, Tapestry handles that in a nice way and displays an empty string instead of thrown a null pointer exception.

if person is null however, it returns an error which means I often have to write custom getter methods in my page class to check for null person objects myself.

I'd rather tapestry just displayed an empty string in the rendered page if person or name is null to make my code cleaner.

Is is possible to do this?

Thanks folks,

Dave.

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


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

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


RE: How Tapestry handles null values in template

Posted by "Poder, Jacob" <ja...@thermofisher.com>.
Hi,

Try ${person?.name}


Best,
Jacob

-----Original Message-----
From: David Siedlecki [mailto:david.siedlecki@beatsystems.com] 
Sent: 12. april 2013 13:15
To: users@tapestry.apache.org
Subject: How Tapestry handles null values in template

Hi. In my template I can do this...

${person.name}

if name is null, Tapestry handles that in a nice way and displays an empty string instead of thrown a null pointer exception.

if person is null however, it returns an error which means I often have to write custom getter methods in my page class to check for null person objects myself.

I'd rather tapestry just displayed an empty string in the rendered page if person or name is null to make my code cleaner.

Is is possible to do this?

Thanks folks,

Dave.

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


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