title: Go back to same JSP that sent request with RequestDispatcher in Servlet
body: <p>I have a servlet which can get requests by multiple JSP's.</p>
  
  <p>But when I use the RequestDispatcher in the servlet, I don't know how to forward to the JSP that sent the request.</p>
  
  <pre><code>req.getRequestDispatcher("page.jsp").forward(req, resp);
  </code></pre>
  
  <p>I know there is something like this in html: javascript:javascript:history.go(-1)</p>
  
  <p>I just need something like this:</p>
  
  <pre><code>req.setAttribute("originalRequest", req.getRequestPage());
  req.getRequestDispatcher(originalRequest).forward(req, resp);
  </code></pre>
  
  <p>That piece of code is probably very noob but it gives you the idea of what I need.</p>
  
  <p>So: I need to forward to the page that sent the original request (basically reload the page), but because multiple jsp's use the servlet, I cannot simply forward to "page.jsp"</p>