You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Richard Stack <ri...@rogers.com> on 2003/07/11 03:07:38 UTC

Problem with DynaActionForms

I'm implementing DynaActionform for the first time. I'm defining them in 
struts-config.xml.
<form-bean
     name="loginForm"
     dynamic="true"
     type="org.apache.struts.validator.DynaValidatorForm">
     <form-property name="userName" type="java.lang.String"/>
     <form-property name="password" type="java.lang.String"/>
  </form-bean>

<action
    path="/signin"
    type="com.acme.LoginAction"
    scope="request"
    name="loginForm"
    validate="true"
    input="/start/signin.jsp">
    <forward name="Success" path="/action/mainPage.jsp"/>
    <forward name="Failure" path="/start/signin.jsp" redirect="true"/>
  </action>

The problem seems to be when I try to reference the form in the Action 
class's execute method. I get an error message in LoginAction 
"Unresolved symbol LoginForm".

public ActionForward execute(){
	String userName = ((LoginForm)form).getUserName();
     	String password = ((LoginForm)form).getPassword();
}

Anyone have an idea where I went wrong?

Richard


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


Re: Problem with DynaActionForms

Posted by Richard Stack <ri...@rogers.com>.
Thanks That solved my problem.

Richard

Tan Khay Ong wrote:
> You are using the Dynamic form. It doesn't create java class for
> loginForm.
> All values are stored in the Map of DynaValidatorFrom. You can retrieve
> form value as below.
> 
> DynaValidatorForm dyform = (DynaValidator) form;
> String userName = (String) dyform.get("userName");
> String password = (String) dyform.get("password");
> 
> -----Original Message-----
> From: Richard Stack [mailto:richardstack@rogers.com] 
> Sent: Friday, July 11, 2003 9:08 AM
> To: struts-user@jakarta.apache.org
> Subject: Problem with DynaActionForms
> 
> 
> I'm implementing DynaActionform for the first time. I'm defining them in
> 
> struts-config.xml.
> <form-bean
>      name="loginForm"
>      dynamic="true"
>      type="org.apache.struts.validator.DynaValidatorForm">
>      <form-property name="userName" type="java.lang.String"/>
>      <form-property name="password" type="java.lang.String"/>
>   </form-bean>
> 
> <action
>     path="/signin"
>     type="com.acme.LoginAction"
>     scope="request"
>     name="loginForm"
>     validate="true"
>     input="/start/signin.jsp">
>     <forward name="Success" path="/action/mainPage.jsp"/>
>     <forward name="Failure" path="/start/signin.jsp" redirect="true"/>
>   </action>
> 
> The problem seems to be when I try to reference the form in the Action 
> class's execute method. I get an error message in LoginAction 
> "Unresolved symbol LoginForm".
> 
> public ActionForward execute(){
> 	String userName = ((LoginForm)form).getUserName();
>      	String password = ((LoginForm)form).getPassword();
> }
> 
> Anyone have an idea where I went wrong?
> 
> Richard
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 



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


RE: Problem with DynaActionForms

Posted by Tan Khay Ong <kh...@ewarna.com>.
You are using the Dynamic form. It doesn't create java class for
loginForm.
All values are stored in the Map of DynaValidatorFrom. You can retrieve
form value as below.

DynaValidatorForm dyform = (DynaValidator) form;
String userName = (String) dyform.get("userName");
String password = (String) dyform.get("password");

-----Original Message-----
From: Richard Stack [mailto:richardstack@rogers.com] 
Sent: Friday, July 11, 2003 9:08 AM
To: struts-user@jakarta.apache.org
Subject: Problem with DynaActionForms


I'm implementing DynaActionform for the first time. I'm defining them in

struts-config.xml.
<form-bean
     name="loginForm"
     dynamic="true"
     type="org.apache.struts.validator.DynaValidatorForm">
     <form-property name="userName" type="java.lang.String"/>
     <form-property name="password" type="java.lang.String"/>
  </form-bean>

<action
    path="/signin"
    type="com.acme.LoginAction"
    scope="request"
    name="loginForm"
    validate="true"
    input="/start/signin.jsp">
    <forward name="Success" path="/action/mainPage.jsp"/>
    <forward name="Failure" path="/start/signin.jsp" redirect="true"/>
  </action>

The problem seems to be when I try to reference the form in the Action 
class's execute method. I get an error message in LoginAction 
"Unresolved symbol LoginForm".

public ActionForward execute(){
	String userName = ((LoginForm)form).getUserName();
     	String password = ((LoginForm)form).getPassword();
}

Anyone have an idea where I went wrong?

Richard


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



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