Struts Validator does not work

I spent a whole day trying to figure out a Struts validator problem. It's an web application containing three modules, but only one module does not perform Struts validation. The XML config files are perfectly fine, but no clue was given by the logger or compiler. The log file spits validateInteger error, but no helpful hints what so ever was given even after turning on the root level logging to DEBUG level.

The only difference between the performing modules, and not performing module is that ActionForm validation vs. DynaValidatorForm. This shouldn't cause validator to malfunction, IMO. After much googling, the answer turned out to be mismatching struts.jar and validation-rules.xml file. The main cause of the problem was from upgrading Struts framework from 1.2.4 to 1.2.7 in order to utilize the latest LazyDynaValidatorForm, which is available since Struts 1.2.6. While upgrading struts.jar, I haven't update the *.tld, *.dtd and *.xml files.

Lesson learned: when upgrading Struts, make sure you upgrade both *.jar files and necessary configuration files.

Tags: 

Comments

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.