title: How to use servlets in struts2
body: <p>i have a struts2 web app and I want to use a servlet in my project,but struts2's filter does not allow to call servlets
  I have looked into <a href="https://stackoverflow.com/questions/3843548/filter-mapping-for-everthing-to-struts2-besides-one-servlet">this</a> solution, but unfortunately it didn't work out and the problem still stands.</p>
  
  <p>Any ideas?</p>
  
  <p>servlet code:</p>
  
  <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          System.out.print("morteza");
              OutputStream o = response.getOutputStream();
              InputStream is = new FileInputStream(new File("d:/Desert.jpg"));
              byte[] buf = new byte[32 * 1024]; 
              int nRead = 0;
              while( (nRead=is.read(buf)) != -1 ) {
                  o.write(buf, 0, nRead);
              }
              o.flush();
              o.close();
              return; 
      }
  </code></pre>
  
  <p>struts.xml:</p>
  
  <pre><code>&lt;struts&gt;
  
      &lt;constant name="struts.enable.DynamicMethodInvocation" value="true" /&gt;
      &lt;constant name="struts.devMode" value="false" /&gt;
      &lt;constant name="struts.custom.i18n.resources" value="ApplicationResources" /&gt;
      &lt;constant name="struts.action.excludePattern" value="Ser"/&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre><code>      &lt;servlet&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;Ser&lt;/display-name&gt;
      &lt;servlet-name&gt;Ser&lt;/servlet-name&gt;
      &lt;servlet-class&gt;Ser&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Ser&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/Ser&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>webpage:</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8"
      pageEncoding="UTF-8"%&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=UTF-8"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  fap
  &lt;img src="Ser" height="200" width="400"/&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>