struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Sayre" <richardsa...@gmail.com>
Subject Populate Form from DAO
Date Fri, 01 Feb 2008 12:37:04 GMT
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message