aspose file tools*
The moose likes Struts and the fly likes Validation Framework w/ DispatchAction Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation Framework w/ DispatchAction Problem" Watch "Validation Framework w/ DispatchAction Problem" New topic
Author

Validation Framework w/ DispatchAction Problem

Elle Atechsy
Ranch Hand

Joined: Jan 23, 2004
Posts: 96
Hi All,

I've given you all about a week's break. So, here I am again!

I'm using the Validator Framework, DynaValidatorActionForms, & DispatchActions. Since, I'm using the Dyna'Forms, I have the Validator Framework's validator.xml form definition mapped to the ActionMapping's path, instead of the formBean name. And, my ActionMapping validate attribute is set to "true".


The problem is...

For some of my JSP pages, On Load, I need to go to an action class to get values from DB to pre-pop fields in the forms, however, in this particular "page entry" event I do "not" need the Validation Framework to validate.

Would anyone happen to know if there is a way to turn on/off the validate attribute on the ActionMapping? If that cannot be done, is there a way to tell the Validator not to do anything by defining something in the validate.xml?

Any assistance much appreciated.

Thanks,
Lulu
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
you can use validwhen (or requiredif) for every single field of the validation. this way is really painful though. i usually have 2 action-mappings mapped to the same DispatchedAction class (2 Actions if you're using Action) and same form-bean. for example:

<action path="/search/entry" name="SearchForm" type="com.my.actions.SearchAction" validate="false" parameter="submitAction"/>
(the validate="false" is optional)

and

<action path="/search/execute" name="SearchForm" type="com.my.actions.SearchAction" validate="true" input="/search/entry.do" parameter="submitAction"/>

obviously, you'd call the /search/entry.do which contains a form mapped to /search/execute.do.
[ May 09, 2005: Message edited by: alan do ]

-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Elle Atechsy
Ranch Hand

Joined: Jan 23, 2004
Posts: 96
Thanks! That did the trick!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation Framework w/ DispatchAction Problem