You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tea Yu <te...@netvigator.com> on 2004/06/24 05:34:44 UTC

Re: Any way to auto populate nested properties?

Hi,

I came across some situation when I got to populate properties into classes
nested in several levels.  Suppose I have these classes (a not-that-good
example):

public class User {
  public UserProfile getProfile() {}
}

public class UserProfile {
  public Address getAddress() {}
}

public class Address {
  public String getLine1() {}
}

and then bind a TextField value to user.profile.address.line1, while
user.profile OR user.profile.address is initially null.

Is it possible for Tapestry to initialize necessary classes and populate the
property by reflection during form rewind?  With the assumption that the
property isn't declared persistent?

I'm kind of new to Tapestry and if I don't remember wrong, this was not
covered in the Action book... anyone had similar experience?

Thanks
Tea



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Any way to auto populate nested properties?

Posted by Tea Yu <te...@netvigator.com>.
Hi Erik,

Thanks for the clues.  In the meantime I'll stick to some "denormalized"
workaround, and will try to figure it out after I finished my recent
project.  It seems this is not a common practice that nobody came
across...??

Tea


>
> On Jun 23, 2004, at 11:34 PM, Tea Yu wrote:
> > and then bind a TextField value to user.profile.address.line1, while
> > user.profile OR user.profile.address is initially null.
>
> OGNL itself has a mechanism for handling this situation:
>
> http://www.ognl.org/2.6.5/Documentation/html/DeveloperGuide/
> nullHandler.html
>
> But Ii don't believe it is possible to hook this in to Tapestry's use
> of OGNL currently.  It probably has to be registered in a similar
> manner to how I added the TypeConverter extension to Tapestry.
>
> Anyone else know if this is possible as-is?  Or does a new extension
> need to be added to support this?
>
> Erik



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Any way to auto populate nested properties?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 23, 2004, at 11:34 PM, Tea Yu wrote:
> and then bind a TextField value to user.profile.address.line1, while
> user.profile OR user.profile.address is initially null.

OGNL itself has a mechanism for handling this situation:

	http://www.ognl.org/2.6.5/Documentation/html/DeveloperGuide/ 
nullHandler.html

But Ii don't believe it is possible to hook this in to Tapestry's use  
of OGNL currently.  It probably has to be registered in a similar  
manner to how I added the TypeConverter extension to Tapestry.

Anyone else know if this is possible as-is?  Or does a new extension  
need to be added to support this?

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org