aspose file tools*
The moose likes Struts and the fly likes How to set alwaysInvokeValidate globally to false (S2) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to set alwaysInvokeValidate globally to false (S2)" Watch "How to set alwaysInvokeValidate globally to false (S2)" New topic
Author

How to set alwaysInvokeValidate globally to false (S2)

Mike Cobelmach
Greenhorn

Joined: Jun 17, 2009
Posts: 19
I need to set alwaysInvokeValidate to false globally because I don't want write this to all action separatly.

<interceptor-ref name="workflow">
<param name="alwaysInvokeValidate">false</param>
</interceptor-ref>


In other words - I need set up Struts 2 default configuration to another value.

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Define your own interceptor stack, set the parameter, and use that stack as the default stack.
Mike Cobelmach
Greenhorn

Joined: Jun 17, 2009
Posts: 19
Thank you Dave for your response, but this didn't solve my problem.

This is description of my problem:

I have one class named BaseClass, which has method validate(). Next have another one class named SubClass, which extends BaseClass. There have method validate, too, which overrides inherited method validate from BaseClass:



In class SubClass have two methods - accept and decline. I want apply validation only on method accept. Therefore I made method



I hoped, if I good understand to set variable alwaysInvokeValidate to false, that method validate will be called only if I will not have method validate{MyMethodName}()...

But I set alwaysInvokeValidate to false and validate method is still called when I call method decline.

I use anotation @SkipValidation on method decline, too.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Oh; I think I misunderstood what you meant.

Hmm; I would have thought that would work. Which version of S2 are you using?
Mike Cobelmach
Greenhorn

Joined: Jun 17, 2009
Posts: 19
I am using 2.0.14 version of Struts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set alwaysInvokeValidate globally to false (S2)