You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Delamere <ho...@michael-delamere.de> on 2002/08/17 11:00:55 UTC

validator plugin

Hi,

I´m having problems using the validator plugin.  When leaving fields blank,
I expect struts to take me back to the registration form.  I copied most of
the code from an example and read the chapter concening this topic in the
orreilly book.

For some reason though it appears that nothing is happening!  Well, I added
my own version of the validation mehod in my form bean just to see if it
goes in there at all and it does.  However the ActionErrors is always empty.

============ VALIDATE ===============
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
  ActionErrors errors = super.validate(mapping, request);

  System.out.println("VALIDATING!!" + errors.size());  // this always
returns 0
  return errors;
 }
========= STRUTS-CONFIG ============
Here are my entries in my struts-config.xml:
  <form-bean name="registrationForm"
type="com.morelogs.ims.formbeans.RegisterFB"/>

  <action path="/saveRegister"
   type="com.morelogs.ims.actions.SaveRegisterAction"
   name="registrationForm"
   input="register.do"
   scope="request"
   validate="true">
   <forward name="success" path="/../WEB-INF/templates/Register_ok.vm" />
         <forward name="error"   path="/../WEB-INF/templates/Register.vm"/>
  </action>

[.......]

 <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
   <set-property property="pathname"
value="/WEB-INF/conf/validator-rules.xml"/>
   <set-property property="pathname" value="/WEB-INF/conf/validation.xml"/>
 </plug-in>
==============================
I´ve rechecked the files about 10 times and I just don´t seems to be able to
get it to work.

Another question I have is, when validation is false, do I get redirected
back to the form automatically or do I have to specify this in the Action
class using:

return mapping.findForward("registrationForm"); ?

Any help on this matter would be greatly appreciated,

Thanks,

Michael



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