DynaValidatorForm with validate()

2003-01-29 Thread Susan Bradeen
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]




RE: DynaValidatorForm with validate()

2003-01-29 Thread Sri Sankaran
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]




RE: DynaValidatorForm with validate()

2003-01-29 Thread Susan Bradeen
Thank you, Sri!

Susan Bradeen
SoftLanding Systems, Inc
[EMAIL PROTECTED]





Sri Sankaran [EMAIL PROTECTED]
01/29/2003 02:47 PM
Please respond to Struts Users Mailing List

 
To: Struts Users Mailing List [EMAIL PROTECTED]
cc: 
Subject:RE: DynaValidatorForm with validate()


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]





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