Did you try setting the type attribute of the <form-bean> to 
full.qualified.ProfileForm?

Sri

> -----Original Message-----
> From: Susan Bradeen [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, January 29, 2003 2:44 PM
> To: [EMAIL PROTECTED]
> Subject: DynaValidatorForm with validate()
> 
> 
> Can you override (or supplement?) a DynaValidatorForm with a 
> form bean, 
> and use the validate() method along with the validations 
> specified in the 
> validation.xml? I can display my validation.xml errors, but 
> not any from 
> my validate() method. It appears to bypass it and go right to the 
> 'success' page. Seems like this should work, but obviously I 
> am missing 
> something. 
> 
> I have a DynaValidatorForm and a "form bean" and action mapping as 
> follows:
> 
> <form-bean
>   name="profileform"
>   type="org.apache.struts.validator.DynaValidatorForm">
>   <form-property
>     name="userName"
>     type="java.lang.String" />
>   <form-property
>     name="password"
>     type="java.lang.String" />
>   <form-property
>     name="confirmPassword"
>     type="java.lang.String" />
>   ...
> </form-bean>
> 
> public class ProfileForm extends DynaValidatorForm {
>   public ProfileForm() {
>     super();
>   }
>  
>   public ActionErrors validate(ActionMapping mapping, 
> HttpServletRequest request) 
> {
>     ActionErrors errors = super.validate(mapping, request);
>     if (errors == null) {
>        errors = new ActionErrors();
>     }
>  
>     String pw = (String)this.get("password");
>     String cpw = (String)this.get("confirmPassword");
>  
>     if (!(pw.equals(cpw))) {
>         errors.add(ActionErrors.GLOBAL_ERROR, new 
> ActionError("error.validate.password"));
>     }
>  
>     if (errors.isEmpty()) {return null;}
>     return (errors);
>   } 
> }
> 
> 
> <action
>    path="/savenewprofile"
>    type="com.etc.actions.RegisterPostAction"
>    name="profileform"
>    scope="request"
>    input=".register"
>    validate="true">
>    <forward name="success" path=".login"/>
>    <forward name="cancel" path=".main"/>
> </action>
> 
> 
> Any suggestions? 
> 
> Susan Bradeen
> SoftLanding Systems, Inc
> [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to