title: how to add excludeMethods parameter list for custom interceptor in struts2
body: <p>How can I add <code>excludeMethods</code> parameter list for my custom interceptor in <code>struts.xml</code> file.
  <code>workflow</code> and <code>validation</code> interceptor have this parameter i.e <code>excludeMethods</code> through witch the <code>workflow</code> interceptor will not fire for excluded methods as described like this:</p>
  
  <pre><code>&lt;action name="action" class="abc.ActionClass"&gt;
  &lt;interceptor-ref name="defaultStack"&gt;
  &lt;param name="workflow.excludeMethods"&gt;doSomething&lt;/param&gt;
  &lt;/interceptor-ref&gt;
  &lt;result&gt;Success.jsp&lt;/result&gt;
  &lt;/action&gt; 
  </code></pre>
  
  <p>This I know. What I want to know is how can I do the same for my custom interceptor. I tried but failed. Here is my code:</p>
  
  <p><strong>index.jsp</strong></p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib uri="/struts-tags" prefix="s" %&gt;    
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;s:url action="go2"  method="forGo2" var="v_go2"/&gt;
  &lt;a href="&lt;s:property value='#v_go2'/&gt;"&gt;HIT to check if excludeMethods parameter working or NOT.&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>struts.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  
  &lt;!DOCTYPE struts PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
      "http://struts.apache.org/dtds/struts-2.3.dtd"&gt;
  
  &lt;struts&gt;
  &lt;package name="abc" extends="struts-default"&gt;
  
  &lt;interceptors&gt;
  
  &lt;interceptor name="cust_intrcptr" class="pack.MyInterceptor2"&gt;
  &lt;param name="excludeMethods"&gt;forGo2&lt;/param&gt; &lt;!-- parameter for excluded method --&gt;
  &lt;/interceptor&gt;
  
  &lt;interceptor-stack name="mystack2"&gt;
  &lt;interceptor-ref name="defaultStack"/&gt;
  &lt;interceptor-ref name="cust_intrcptr"/&gt;
  &lt;/interceptor-stack&gt;
  
  &lt;/interceptors&gt;
  
  &lt;action name="go2" class="pack.GoAction" method="forGo2"&gt;
  &lt;interceptor-ref name="mystack2"/&gt;
  &lt;result name="success"&gt;/welcome2.jsp&lt;/result&gt;
  &lt;/action&gt;
  &lt;/package&gt;
  &lt;/struts&gt;   
  </code></pre>
  
  <p><strong>custom-interceptor</strong></p>
  
  <pre><code>package pack;
  
  import com.opensymphony.xwork2.ActionInvocation;
  import com.opensymphony.xwork2.interceptor.Interceptor;
  
  public class MyInterceptor2 implements Interceptor{
  
      @Override
      public void destroy() {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void init() {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public String intercept(ActionInvocation ai) throws Exception {
          // TODO Auto-generated method stub
        System.out.println("#####Inside Interceptor#####");
        ai.invoke();
      }
  
  }
  </code></pre>
  
  <p><strong>Action Class</strong></p>
  
  <pre><code>package pack;
  
  import com.opensymphony.xwork2.ActionSupport;
  
  public class GoAction extends ActionSupport{
      public String forGo2(){
          return "success";
      }
  }
  </code></pre>
  
  <p>Output generated without any errors. But in console output I am viewing "<code>#####Inside Interceptor#####</code>" that I did not expected because I excluded the interceptor for <code>forGo2</code> method. How can I exclude this interceptor for any given method in this case like <code>forGo2</code>.</p>