title: How to redirect the response of a servlet into the same jsp page from where we got the request
body: <p>How can I redirect a response of a servlet to the same jsp page from where I get the request. Suppose I have a tab called status on my jsp page
  <code>http://localhost:8080/Example/status.jsp</code>. Now when I send a request and when I get a response,it should display the response on the same page, ie. it should show response on<br>
  <code>http://localhost:8080/Example/status.</code>jsp. But it is showing me the response in<br>
  <code>http://localhost:8080/Example/Status</code>where Status is the url-pattern in web.xml file. Please any help is appreciated. below is my code.
  How do I get the response in status.jsp.</p>
  
  <pre><code>protected void doPost(HttpServletRequest req, HttpServletResponse res) throws 
  IOException {
  
               try{
  
                   String showstatus =req.getParameter("showstatus");
                   PrintWriter out = res.getWriter();   
                   Runtime rt = Runtime.getRuntime();
                   Process pr = rt.exec("C:\\tools\\server\\util stat -a" );
                   BufferedReader stdInput = new BufferedReader(new   
  InputStreamReader(pr.getInputStream()));
  
                  BufferedReader input = new BufferedReader(stdInput);
                  String stat = "";
                      while((stat = input.readLine()) != null){
                          out.println(stat);
                      }
               }
                  catch (Throwable t)  
                    {  
                      t.printStackTrace();  
                    }  
  
  
                  finally {  
  
                  }  }
  </code></pre>
  
  <p>JSP CODE:</p>
  
  <pre><code>&lt;div id= "status" style="display:none;"&gt;
              &lt;FORM action="status" METHOD="POST"&gt;
                  &lt;input type=submit name=showstatus 
  id=txtSubmit value=Status /&gt;
  
              &lt;/FORM&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>WEB.XML: </p>
  
  <pre><code>&lt;servlet&gt;       
      &lt;servlet-name&gt;Status&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.emc.clp.license.Status&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Status&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/status&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>