You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Robert S. Sfeir" <ro...@sfeir.net> on 2003/02/06 20:19:57 UTC
DynaActionForms - solved...
Ok if I got everything correctly, I've setup the form in the struts
config file then did this in my action:
public ActionForward execute(
ActionMapping mapping , ActionForm form , HttpServletRequest request ,
HttpServletResponse response ) throws DatastoreException
{
UserDAO userImpl = DAOFactory.getDAOFactory( Constants.DAO_FACTORY
).createUserDAO();
UserBO user = new UserBO();
DynaActionForm dForm = ( DynaActionForm ) form;
user.setAccountStatus( ( String ) dForm.get( "accountStatus" ) );
user.setUserID( ( Integer )dForm .get( "userID" ) );
...
//Adds user via DAO impl with OJB
userImpl.addUser(user);
}
If I understand this correctly, I can either have one form with all the
possible fields in my application (YUK) or organize the fields by
functionality of my application... like in this case it's called the
securityForm and contains everything about a user, the address, phone
info, group info etc... and I use it for registration, login, but not
things like credit card for the store, since the store would have its
own form for the credit card data and all that.
Is that pretty much the gist of it? Or is there more to this? It's
pretty awesome just like that!
I noticed there was a size value for each field, is that to make sure
that the value does not exceed a certain length? if no isn't that what
the validator is supposed to do?
Thanks
R
R
--
Robert S. Sfeir
Senior Java Engineer
National Institutes of Health
Center for Information Technology
Department of Enterprise Custom Applications
sfeir@mail.nih.gov
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org