In webwork if the property is null the ww construct the object, and i think
that's use OGNL to do this,
http://www.opensymphony.com/ognl/html/DeveloperGuide/nullHandler.html ...


This is the part of WW in Action (Manning) that talk about that... Maybe,
Tapestry implement htis some day (as soon as possible, hehe)

As you become more familiar with writing WebWork applications, you'll often
find
yourself setting the values of properties using complex expressions. For
instance,
if you need to write a page that asks for Kermit's name, his father's name,
and his
grandfather's name, you can do one of two things:
■ Set the properties name, fatherName, and grandfatherName in your action,
and then write code that creates three Muppets, sets their names, and
reconnects
their relationships.
■ Set the properties kermit.name, kermit.father.name, and
kermit.father.father.name, and include a single Muppet object, kermit, in
your action.
Clearly, the second choice is simple: It involves only one property in your
action
instead of three, and it doesn't require you to reconstruct the objects. But
how?
Recall that there is no constructor in Muppet that places stubs for the
father property,
which means that attempting to set kermit.father.name with a value will
result in a NullPointerException.
This is where OGNL steps in. It provides a way to swap in a null object with
a
real object whenever access to a property on a null object is detected. With
Web-
Work's assistance, OGNL essentially constructs the object graph of the
son-fathergrandfather relationship automatically, reducing the code you need
to write.

On 4/24/06, Geoff Longman <[EMAIL PROTECTED]> wrote:
>
> The ognl expression translates into java calls.
>
> So client.address.street would translate into
>
> getClient().getAddress().getStreet()
>
> if getClient() or getAddress() return null, boom you get an NPE.
>
> I doubt that if webwork is using OGNL that the behaviour there is any
> different from what I have described.
>
> Geoff
>
> On 4/24/06, Angelo Luis <[EMAIL PROTECTED]> wrote:
> > I have a Client that have a Adrress and i want to navigate in the object
> > graph in that way : client.address.street, without have a null pointer
> > exception... how can i do that...
> >
> > I  kwon that i can do that with webwork. is that a way to do in
> tapestry???
> > Both (tapestry and ww) uses OGNL, so ....
> >
> > PS; sorry for my english!
> >
> >
>
>
> --
> The Spindle guy. http://spindle.sf.net
> Blog:                  http://jroller.com/page/glongman
> Other interests:  http://www.squidoo.com/spaceelevator/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to