You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Purcell <sp...@vertisinc.com> on 2005/02/22 21:38:02 UTC
DynaActionForms Question
Hello,
I have a question about using DynaActionForm objects. I would like to use DynaActionForm class to keep maintenance simpler. But I do not know how to get the form values out in the action class?
I have the following bean set up.
<form-beans>
<form-bean
name="loginbean"
type="org.apache.struts.action.DynaActionForm">
<form-property name="name" type="java.lang.String" initial="Titan" />
</form-bean>
</form-beans>
Now in the action class when I am working in the execute() method
how do I get the data back from the bean?
I tried the following
public ActionForward executeAction(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
UserContainer userContainer)
throws Exception {
// MenuObject menu = new MenuObject();
System.out.println((String)form.getName());
and of course it will not compile, because it doesn't recognize any methods in the form. Can you not get data back from a dynaform like you can a normal bean?
Thanks
Scott
RE: DynaActionForms Question
Posted by Joe Hertz <jh...@speakeasy.net>.
DynaActionForm df = (DynaActionForm) form;
System.out.println(df.get("name"));
-----Original Message-----
From: Scott Purcell [mailto:spurcell@vertisinc.com]
Sent: Tuesday, February 22, 2005 3:38 PM
To: user@struts.apache.org
Subject: DynaActionForms Question
Hello,
I have a question about using DynaActionForm objects. I would like to use
DynaActionForm class to keep maintenance simpler. But I do not know how to
get the form values out in the action class?
I have the following bean set up.
<form-beans>
<form-bean
name="loginbean"
type="org.apache.struts.action.DynaActionForm">
<form-property name="name" type="java.lang.String" initial="Titan"
/>
</form-bean>
</form-beans>
Now in the action class when I am working in the execute() method
how do I get the data back from the bean?
I tried the following
public ActionForward executeAction(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
UserContainer userContainer)
throws Exception {
// MenuObject menu = new MenuObject();
System.out.println((String)form.getName());
and of course it will not compile, because it doesn't recognize any methods
in the form. Can you not get data back from a dynaform like you can a normal
bean?
Thanks
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org