It's not a secret anymore!
The moose likes Struts and the fly likes Struts validation does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts validation does not work" Watch "Struts validation does not work" New topic

Struts validation does not work

Jerry Wang

Joined: Aug 04, 2004
Posts: 2
I have defined my form

<form-bean name="registrationForm"

And my action definition is

<action path="/register"

I already configured the validator plugin in struts-config.xml

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

And in validation.xml

<form name="/register">
<field property="firstName"
<arg0 key="FirstName" resource="false"/>

It seems not working. Because I submit my form with the firstName blank I did not get the error messages as expected. I did put the


in my jsp page.

Please help and thanks in advance!
Nimchi Yung
Ranch Hand

Joined: Jan 27, 2004
Posts: 71
Change your validation.xml to

Jerry Wang

Joined: Aug 04, 2004
Posts: 2
Originally posted by Nimchi Yung:
Change your validation.xml to


Thanks Nimchi,

I tried that in the first place and did not work. What other possible ways could make it not work?

Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Nimchi is correct, though.

Another thing to check is that you are defining firstName in the formbean of struts-config.

A good workman is known by his tools.
I agree. Here's the link:
subject: Struts validation does not work
It's not a secret anymore!