Did you try :
MyObject theObject;
(geter and setter on theObject)
execute () {
theObject = myDAO.getRecord(id);
}
And in the JSP : <s:property value="theObject.member1"/>
-----Message d'origine-----
De : Richard Sayre [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 1 février 2008 13:37
À : Struts Users Mailing List
Objet : Populate Form from DAO
Struts 2 allows us to automatically populate our forms if we name our fields
correctly, which is wonderful.
My actions usually go something like this
execute () {
MyObject o = myDAO.getRecord(id);
member1 = o.getMember1();
member2 = o.getMember2();
}
MyObject is a JO for hold a row in the database. I like the fact that I can
name my form field 'member1' and it the interceptor will set and get from my
Action. I dont like having to set up each member variable in the action with
the members my class. Is it possible to somehow have Struts automatically
populate an Java Object rather then the Action? I thought I remember reading
about this before but I'm not sure. It's not a big deal, and I know I can use
OGNL to access the value, but I wanted the convience of mapping a fieldName to
my custom object. Is this possible?
Thank you,
Rich
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail, any attachments and the information contained therein ("this
message") are confidential and intended solely for the use of the addressee(s).
If you have received this message in error please send it back to the sender
and delete it. Unauthorized publication, use, dissemination or disclosure of
this message, either in whole or in part is strictly prohibited.
**********************************************************************
Ce message électronique et tous les fichiers joints ainsi que les informations
contenues dans ce message ( ci après "le message" ), sont confidentiels et
destinés exclusivement à l'usage de la personne à laquelle ils sont adressés.
Si vous avez reçu ce message par erreur, merci de le renvoyer à son émetteur
et de le détruire. Toutes diffusion, publication, totale ou partielle ou
divulgation sous quelque forme que se soit non expressément autorisées de ce
message, sont interdites.
**********************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]