• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why My Validation Lets All Errors Pass Through?

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind. I have found the mistake. Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic