Hello,

 

How do I use, say, the <bean:write> tag to print out the value of a nested
property, if there's a possibility that the parent of the nested property
may be Null?

 

I have a User bean with method getAuthorityLevel which returns an instance
of the AuthorityLevel bean.  The AuthorityLevel bean then has a method
getName, which returns a string.  I have something like this in my JSP:

 

<bean:write name="myUser" property="authorityLevel.name"/>

 

This works fine if the User bean in the "myUser" variable has an
AuthorityLevel, but if it does not then getAuthorityLevel returns Null, and
Struts then throws a NullPointerException.  Is there a simple way around
this?

 

Do the "Nested Tags" address this situation?

 

Thanks!

David

 

David A. Ventimiglia

Wells Fargo Private Client Services

(415) 396-0414 (work)

 

Reply via email to