title: How to include a Servlet inside the post method of another Servlet?
body: <p>I have a Servlet called Menu that generates some html and a dynamic menu,
  I mean by dynamic that the links in the menu change each time the user select a table in a frame, here is a quick exemple:</p>
  
  <pre><code>Browse?table=student
  Search?table=student
  
  Browse?table=professor
  Search?table=professor
  </code></pre>
  
  <p>I included this Servlet in the beginning of most of my servlets in order to optimise modifications, I used the following code:</p>
  
  <pre><code>RequestDispatcher dispatcher = request.getRequestDispatcher("/Menu?table="+tableName);
  dispatcher.include(request, response);
  </code></pre>
  
  <p>but when I try to send a post request to Servlet that contain the previous code, I receive an error saying:
      HTTP Status 405 - HTTP method POST is not supported by this URL</p>
  
  <p>I'm using NetBeans 6.9.1 and TomCat 6.0.26 and Java version 1.6</p>
  
  <p>So is there any way to include my Servlet Menu in the POST method of another Servlet?
  or is there another solution to have the dynamic menu other than a Servlet?</p>
  
  <p>To explain more to you guys, here is the code of my Servlet:</p>
  
  <pre><code>public class ExecuteAnySql extends HttpServlet {
  
  //No problem here
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  //code
  //include the Menu Servlet
  //code
  }
  
  //this does not work when I include the Menu Servlet
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  //code
  //include the Menu Servlet
  //code
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks guys, I think that I found a solution,</p>
  
  <p>The solution you provide me will work only if I have 1 Servlet, but I have too many and I want that they share the same menu.</p>
  
  <p>So all I have to do is to make a static method that takes the table name as a parameter and generate the html code.
  If I proceed like this, I can call my method from all of my Servlets.</p>