• Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts Validator With Modules

 
Chris Elvart
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the validator framework work with struts modules?

I am experimenting with struts modules using WSAD 5.1 and struts 1.1 and I can't get it to work and can find no references to this anywhere on the web.

I have a module with a validator plugin set up to load module specific validator-rules.xml and validation.xml files and the log shows they get loaded. My actions map correctly, but if I try to use client side validation my elements manufacture no code regardless of what I do. I can't even get the static javascript to come out.

Also, server side pre-action validator validations are not performed even if I tell it to in my action mapping. I have banged my head against this one for a while and am finally asking for help.

<b>???</b><br/>
How does the jsp tag <html:javascript> know what module's rules to load, or do I need to put all of my validation rules in a single multi-module validation rules file (ick!) ?

Here are the relevant sections from the files...
<br/><br/><b>struts-thingy-config.xml<b><br/>

<br/><br/><b>thingy-validator-rules.xml<b> - contains standard struts rules with no additions.<br/>
<br/><br/><b>thingy-validation.xml<b><br/>


<br/>
<b>As a side question...</b><br/>
You see I have rules specified for both "thingyForm" and "/saveThingyAction". Is this normal? I got this setup working in a default module then moved them. In my "/saveThingy" action mapping I tell it to use "thingyForm" but the validator does not load rules for thingyForm but instead loads them for "/saveThingyAction". This is cool because I can have different rules for different actions that use the same form, but it's not cool because I can't specify one set of validation rules for a form regardless of the action it is going to.

How do people usually use this?

Thanks,
Chris
 
Chris Elvart
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I kept fiddling with this and tracked it down to a typo in the struts config file. It works just fine once you fix that.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!