How to implement the equivalent of html:cancel in Struts 2?

Viewed 98

I'm migrating an application from Struts1 to Struts2.

In Struts 1, we have <html:cancel> tag to bypass the form bean validate() method upon clicking.

But in Struts 2, I'm not aware of any similar tag available and I have a validate method in my Action class which automatically gets executed if you press the submit button.

So, how do I migrate the below tag to Struts2?

<html:cancel property="cancel" value="No"/>
1 Answers

AFAIK, the validation interceptor is a method filter interceptor and by default it filters some method names like cancel(). If it doesn't then you can use excludeMethods parameter.

If you name your action method like this and map it to the button it will exclude from validation. The detailed information consists in my answer here.

Related