title: How to invoke a method on submit button in Struts 2 using convention plugin?
body: <p>In the following piece of code about Struts action class,</p>
  <pre class="lang-java prettyprint-override"><code>@Namespace(&quot;/admin_side&quot;)
  @ResultPath(&quot;/WEB-INF/content&quot;)  // Default.
  
  public final class TestAction extends ActionSupport implements Serializable
  {
      private static final long serialVersionUID = 1L;
      private static final String SUCCESS = &quot;success&quot;;
  
      private String name;
      private String email;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      @Override
      @Action(value=&quot;test&quot;,results={@Result(name=&quot;success&quot;,location=&quot;Test.jsp&quot;)})
      public String execute() throws Exception
      {
          System.out.println(&quot;name = &quot;+name);
          System.out.println(&quot;email = &quot;+email);
          return SUCCESS;
      }
  
      // Some annotations to map this method to &lt;s:submit&gt;
      public String postAction()
      {
          System.out.println(&quot;postAction() invoked.&quot;);
          System.out.println(&quot;name = &quot;+name);
          System.out.println(&quot;email = &quot;+email);
          return SUCCESS;
      }
  }
  </code></pre>
  <p>I want to invoke the <code>postAction()</code> method on the given submit button like so,</p>
  <pre class="lang-jsp prettyprint-override"><code>&lt;s:form action=&quot;test&quot;&gt;
      &lt;s:textfield id=&quot;name&quot; name=&quot;name&quot; label=&quot;Enter your name&quot;/&gt;
      &lt;s:textfield id=&quot;email&quot; name=&quot;email&quot; label=&quot;Enter your email&quot;/&gt;
  
      &lt;s:submit value=&quot;Submit&quot; method=&quot;postAction&quot;/&gt;
  &lt;/s:form&gt;
  </code></pre>
  <hr />
  <p>I have seen some questions like <a href="https://stackoverflow.com/q/13333196/1391249">this one</a> but all of them use XML configurations in <code>struts.xml</code>.</p>
  <p>How to make it possible <em>using</em> <a href="https://struts.apache.org/plugins/convention" rel="nofollow noreferrer">convention plugin</a>?</p>