1

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"/>
Roman C
  • 49,761
  • 33
  • 66
  • 176
  • 1
    There are multiple alternatives depending on what you actually want it to do; a submit button with an `action` property may be the easiest solution. – Dave Newton Mar 02 '22 at 17:01

1 Answers1

1

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.

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • If this answer helped to anyone then mark it as accepted answer. The checkbox is on the left of the answer. – Roman C Jul 14 '22 at 10:31