> Jeevan Bihari wrote:
> >  Is there a way to setup the above expression so that OGNL handles a Null
return gracefully
> >anywhere along the call chain ? If at all possible, I would like to avoid
replacing the
> >login.user.name expression with a wrapper method that handles the Null 
> >return.
> >  

Drew Davidson <drew <at> ognl.org> writes:
> OGNL 2.4.0 and above have a handler for this on a class-by-class basis. 
>  It is set with a static method call on OgnlRuntime:
> 
>     OgnlRuntime.setNullHandler(java.lang.Class cls, NullHandler handler)
>
> 
> I refer you to the OGNL API documentation for further details:
> 
>     http://www.ognl.org/2.6.0/Documentation/javadoc/index.html
> 
> - Drew
> 


No one really talks about the best place to register a null handler.  I am using
Tapestry and have created a single super class for all my pages.  Therefore I
created a static initializer section in that papa page and register my null
handlers there.

...just an FYI since the documentation around this topic is light.

Also, if anyone is involved with OGNL, two suggetions:

1. It would be good to know whether the null handling descends based on object
hierarchies and interface usage.

2. It would be good to clarify the class specified in the runtime registration
is the encapsulating class of the potential null property and not the
potentially null class type itself.

 - Lon



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to