The bean:write tag has an attribute for "ignore".  It seems that with ignore
set to true, and a null value is passed in for the bean, the write tag will
avoid a null pointer exception.  However in a situation where you have a
bean with nested properties, if one of those properties is null then you
still get the null pointer exception and your page crashes.  

I support our internal developers in their Stuts efforts, and we are
converting several apps from a proprietary app server to be "J2EE
compliant".  This is a "must" for our staff in their conversion efforts.  So
I modified the bean:write tag to also ignore null nested properties if
ignore is true.  

Finally, my question is: Does this make sense as a Struts base mod?

Essentially then I could write 
     <bean:write name="bean" property="foo.bar.name" ignore="true"/>
where bean is not null, bean.getFoo() is not null, but
bean.getFoo().getBar() returns null.  And my page simply ignores the bean
write without crashing.

Reply via email to