You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by A C <me...@hotmail.com> on 2002/08/20 18:23:15 UTC

How to use DynaValidatorForm?

Hello I am trying to use the DynaValidatorForm in the following way.
In the struts-config file I have
<!-- ========== Action Mappings ============================== -->

<form-beans>
<form-bean name="loginForm"
            dynamic="true"

            type="org.apache.struts.validator.DynaValidatorForm">
            <form-property name="email" type="java.lang.String" />
	    <form-property name="password" type="java.lang.String" />
  </form-bean>
</form-beans>

<!-- ========== Action Mappings ============================== -->

<action-mappings>
  <action path = "/login"
	  parameter="/jsp/security/action/login-body.jsp"
	  type="com.mediamania.struts.security.LoginAction"
	  name="loginForm"
	  validate="true"
	  input="/jsp/security/action/login-body.jsp" >

  </action>
</action-mappings>
<!-- ============= Validator Plug-in ========================== -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  <set-property
     property="pathnames"
     
value="/WEB-INF/validation/validator-rules.xml,/WEB-INF/validation/validator.xml" 
/>
</plug-in>

How to write the LoginAction class, should it extend DynaAction like

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

    // Get the user's login name and password. They should have already
    // validated by the ActionForm.
    String email = ((LoginForm)form).getEmail();
    String password = ((LoginForm)form).getPassword();

    ...
    ....
}

And should LoginForm extend DynaActionForm or DynaValidator form?

Thanks a lot.
I am struts newbie

Anand


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>