Struts Validator

2003-08-14 Thread Stephen Bennett
Has anyone had any problems getting the Struts Validator to work?
 
I have a small sample app that works OK but cannot get my main app to
work! As far as I can see I have done everything the same as in the
sample one.
 
I have noticed that when the sample app that works starts up I get four
messages from the ValidatorPlugin the first pair mentions the
validation.xml and the validator-rules.xml then later it says
ValidatorPlugin initResources then the previous xml messages. 
 
With the real app that doesn't work I don't get these second
initResources messages. I am not sure if this is significant or not,
does anyone have any ideas?
 
I have: -
 
  plug-in className=org.apache.struts.validator.ValidatorPlugIn
set-property
  property=pathnames
  value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
  /plug-in
 
in my struts-config
 
and 
 
  form name=ValidationType
field
  property=code
  depends=required
  arg0 key=validationCode.code/
/field
field
  property=constant
  depends=required,integer
  arg0 key=validationCode.constant/
/field
  /form
 
in my validation.xml
 
validator-rules.xml are default
 
my formbean is extending ValidatorActionForm
 
and my action mapping is
 
action
  path=/ValidationType
  name=validationTypeForm
  input=/jsp/validationtype/validationType.jsp
  type=com.mycompany.ValidationTypeAction
  scope=session
  forward name=Success path=/jsp/success.jsp redirect=true/
  forward name=Failure path=/jsp/failure.jsp redirect=true/
/action
 
I am using Struts 1.1 with Tomcat 4.1.24 on XP
 
Can anyone help?
 
Thanks
 
Steve


RE: Struts Validator

2003-08-14 Thread Stephen Bennett
Thanks Shane, that fixed it.

-Original Message-
From: Bailey, Shane C. [mailto:[EMAIL PROTECTED] 
Sent: 13 August 2003 16:41
To: 'Struts Users Mailing List'
Subject: RE: Struts Validator



In the validation.xml file I believe that the validator takes

form name=StringWithoutForwardSlash  as validate based on form name
and
form name=/stringWithForwardSlash as validate based on the action
name.

Meaning that if the validator sees a formbean with the first examples
name
it does validation and then if it sees an action with same name as the
second example it will do validation on the associated form.

Anyway, in your example you have your action name with not slash so you
would have to have either:

form name=/ValidationType...OR
form name=ValidationTypeForm


You also need to keep in mind that you need to extend ValidationTypeForm
must extend ValidatorActionForm to use the action validation and
ValidatorForm to use the form validation.



-Original Message-
From: Stephen Bennett [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 13, 2003 11:39 AM
To: [EMAIL PROTECTED]
Subject: Struts Validator

Has anyone had any problems getting the Struts Validator to work?
 
I have a small sample app that works OK but cannot get my main app to
work! As far as I can see I have done everything the same as in the
sample one.
 
I have noticed that when the sample app that works starts up I get four
messages from the ValidatorPlugin the first pair mentions the
validation.xml and the validator-rules.xml then later it says
ValidatorPlugin initResources then the previous xml messages. 
 
With the real app that doesn't work I don't get these second
initResources messages. I am not sure if this is significant or not,
does anyone have any ideas?
 
I have: -
 
  plug-in className=org.apache.struts.validator.ValidatorPlugIn
set-property
  property=pathnames
  value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
  /plug-in
 
in my struts-config
 
and 
 
  form name=ValidationType
field
  property=code
  depends=required
  arg0 key=validationCode.code/
/field
field
  property=constant
  depends=required,integer
  arg0 key=validationCode.constant/
/field
  /form
 
in my validation.xml
 
validator-rules.xml are default
 
my formbean is extending ValidatorActionForm
 
and my action mapping is
 
action
  path=/ValidationType
  name=validationTypeForm
  input=/jsp/validationtype/validationType.jsp
  type=com.mycompany.ValidationTypeAction
  scope=session
  forward name=Success path=/jsp/success.jsp redirect=true/
  forward name=Failure path=/jsp/failure.jsp redirect=true/
/action
 
I am using Struts 1.1 with Tomcat 4.1.24 on XP
 
Can anyone help?
 
Thanks
 
Steve

-
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]