You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thomas Thomas <de...@gmail.com> on 2006/11/30 21:59:08 UTC

How to get a dynaform in the Action class ?

Hi,
I have the following DynaValidatorForm :

        <form-bean name="loginForm" type="
org.apache.struts.validator.DynaValidatorForm">
                 <form-property name="login" type="java.lang.String" />
                 <form-property name="password" type="java.lang.String" />
        </form-bean>
        <action
            path="/Login"
            type="controllers.submits.LoginAction"
            name="loginForm"
            input="/Error.do"
            validate="true"
            scope="request">
                <forward name="setup_page"
path="/Setup.do?method=setupPage"/>
         </action>


How am I supposed to get the parameters of this Form bean in the Action
class ?

public class LoginAction extends Action {

    public ActionForward execute(
            ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

            ???  myForm = ( ??? ) form;

            String username = myForm.getLogin();

            [...]



Thank u for any help.

Re: How to get a dynaform in the Action class ?

Posted by Thomas Thomas <de...@gmail.com>.
Wendy,
thank u for your support.

I don't know if I need to choose an ActionForm or DynaActionForm for the
login page.
When do u choose to make it a DynaActionForm ? What's the advantage of it.

Re: How to get a dynaform in the Action class ?

Posted by Wendy Smoak <ws...@gmail.com>.
On 11/30/06, Thomas Thomas <de...@gmail.com> wrote:

> I have the following DynaValidatorForm :
..
> How am I supposed to get the parameters of this Form bean in the Action
> class ?

Section 4.3.1 is popular today. :)
http://struts.apache.org/1.x/userGuide/building_controller.html

"DynaActionForms are not  a drop-in replacement for ActionForms. If
you need to access DynaActionForm properties in your Action, you will
need to use the map-style accessor, like myForm.get("name")."

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org