Michael,

I ran into this problem myself and the online review chapters of Chuck
Cavaness' Struts book provided the answer. According to the chapter on the
Struts Validator,

    "There was some confusion in one of the earlier beta releases for the
Validator that used multiple set-property elements. That is no long
supported and you should use a single set-property element that specifies
multiple Validator resource files, separated by a comma. Also notice that
the property value is the plural *pathnames*."

Your example code indicates you are using the deprecated form with separate
set-property elements. Try this instead:

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

Assuming you are working with the latest beta release or a recent nightly
build, this should help.

Good luck,
  Mike "Van" Riper
  mailto:[EMAIL PROTECTED]


-----Original Message-----
From: Michael Delamere [mailto:[EMAIL PROTECTED]]
Sent: Saturday, August 17, 2002 2:01 AM
To: Struts Users Mailing List
Subject: 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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to