Hi Ronald, is your B component syncronizing bindings? If so, your B instance should receive a call equivalent to « b.takeValueForKey(session().authenticatedUser(), “userAccount”); » so you should comply to KVC for this key (public ivar, get/set method .. your choice) to get it assigned and available.
If your B component is non-synchronized, then you have to get it whenever you need it: « User user = this.valueForBinding(“userAccount”); »
Also, since your B component is in a framework and is aware of the concept of a userAccount, I would try to keep the dependency as loose as possible and NOT add coupling directly with the session object. But if you absolutely have to do it (last resort), it could be done with simple KVC: « User user = (User) session().valueForKey("authenticatedUser”); » or even: « User user = (User) valueForKeyPath(“session.authenticatedUser”); »
Ways of passing generic/contextual objects from the front-end layer to the lower end without adding too much coupling is by going through the editingContext.userInfo dictionary, or through the current thread userInfo dictionary (see ERXThreadStorage). Those 2 objects are available in most lower level objects and can be set from the upper level just as easily.
jfv
On May 29, 2015, at 9:11 AM, HOUNKPONOU Ronald < email@hidden> wrote:
In A.html
<webobject name = "template">
</webobject>
In A.wood
template : B { userAccount = session.authenticatedUser; }
in B.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title> </head> <body> <webobject name = "specialitemedicale"> <label>Libellé</label> <webobject name = "libelle"/> <webobject name = "enregistrer"/> </webobject> </body> </html>
in B.wood
specialitemedicale : WOForm { }
libelle : WOTextField { value = libelle; }
enregistrer : WOSubmitButton { action=""> value="Enregistrer"; }
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|