At the risk of sounding stupid when this one is answered, Heres my problem:
i have a
jsp regMain.jsp and RegistrationForm which is the formbean for this jsps form has a validate method as shown
/**
* Validate the properties that have been set from this HTTP request,
* and return an <code>ActionErrors</code> object that encapsulates any
* validation errors that have been found. If no errors are found, return
* <code>null</code> or an <code>ActionErrors</code> object with no
* recorded error messages.
*
* @param mapping The mapping used to select this instance
* @param request The
servlet request we are processing
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
log.info("validate called");
// Perform validator framework validations
// ActionErrors errors = super.validate(mapping, request);
ActionErrors errors = new ActionErrors();
log.info("after errors");
// Only need crossfield validations here
if ((password != null && confirmPassword != null) && !password.equals(confirmPassword)) {
log.info("password mismatch");
errors.add("password",
new ActionError("error.password.match"));
}
if ((emailAddress != null && confirmEmailAddress != null) && !emailAddress.equals(confirmEmailAddress)) {
log.info("emailAddress mismatch");
errors.add("email",
new ActionError("error.email.match"));
}
log.info("returning from validate of form bean");
return errors;
}
The
struts config has the following action mapping for this forms action path:
<!-- Process a user registration STEP - 1 -->
<action path="/submitRegistration"
type="com.webmd.registration.action.RegistrationAction"
parameter="method"
name="RegisterForm"
scope="request"
input="regMain.jsp"
validate="true">
<forward name="failure" path="/regMain.jsp"/>
<forward name="success_usmd" path="/usmd.jsp"/>
<forward name="success_nurse" path="/nurses.jsp"/>
</action>
Now when i submit the form with different email or password, the form beans validate fails and it returns ActionErrors object with size > 0. But thats all i see. The Action Servlet which should dispatch my request to the input form does not do that although i have my input set as regMain.jsp
Can any of u point u'r torch here and throw some light on this.
TIA
Sahil