File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Why My Validation Lets All Errors Pass Through? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Why My Validation Lets All Errors Pass Through?" Watch "Why My Validation Lets All Errors Pass Through?" New topic
Author

Why My Validation Lets All Errors Pass Through?

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I intentionally left every single field blank and radio buttons not selected, and then submit the form with validation check. All the errors pass through the validation check and the next page gets displayed.

I have commons-validator.jar (6/29/2003) in the AppName/WEB-INF/lib directory. And I have the validation.xml and validator-rules.xml in my AppName/WEB-INF directory.

I have a form like:


My action mapping in the struts-config.xml looks like:

The messageForm in the <form-beans> element of the struts-config.xml looks like:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">


In the validation.xml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
and, inside the <formset> element, I have:
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
You have to have a plugin in struts-config.html

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

Joined: Nov 19, 2000
Posts: 1309
I forgot to mention that the <plug-in ....> is by the end of my struts-config.xml file.

So, there is no obvious anwser to why my validation simply lets all errors pass through even I intentionally made errors for checking purpose.
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Never mind. I have found the mistake. Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why My Validation Lets All Errors Pass Through?