Actually, this is something I want to add to XWork "some day": a way to
make Ognl automatically create objects for you if they are null. Drew
Davidson (Ognl dude) has already added a NullHandler at my request, we
just haven't implemented it in XWork yet. Eventually, the idea is to be
able to do this:
Foo foo = new Foo();
assertNull(foo.getBar());
stack.setValue("foo.bar.name", "Shazam, bar is created");
System.out.println(foo.getBar().getName());
Output:
Shazam, bar is created
Basically, you wouldn't have to initialize the dependant resources if
there is no-arg constructor.
-Pat
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Fred Lamuette
Sent: Thursday, October 16, 2003 10:13 AM
To: [EMAIL PROTECTED]
Subject: [OS-webwork] [OGNL] strange (?) behavior
I know this problem is not obviously in the scope of this mailing list,
but
I'd like to know if I'm dreaming.
public class Bar
{
private String name;
...
}
public class Foo
{
private Bar bar;
...
}
Executing Ognl.getValue("bar.name",foo) generates an exception when bar
is
null. It was not the expected result ... I expected to a null value.
Maybe I
am accustomed too much to BeanUtils from the Jakarta Project ...
Cheers.
Richard.
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork