Identifying JSPs request by Servlet

Discussions

General J2EE: Identifying JSPs request by Servlet

  1. Identifying JSPs request by Servlet (2 messages)

    Hi All,
    I am sending request from 4-jsps to a single servelt and i want to redirect those requests.
    How can I identify a request which came from a specific JSP.

    i.e., 1.jsp,2.jsp,3.jsp,4.jsp are calling dopost() method of MyServlet.
    how come the servlet(MyServlet) knows this request came from 1.jsp?

    thanks in advance

    Santhosh

    Threaded Messages (2)

  2. Referer[ Go to top ]

    Two ways:

    1) Use http referer header: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.36

    2) Add it to your request:
    a) GET method:
    http://myserver/servlet/DispatchServlet?source=1.jsp
    b) POST method: (in a form)
    <form method="POST" action="/servlet/DispatchServlet">
      <input type="hidden" value="1.jsp"/>
    </form>
  3. Referer[ Go to top ]

    Thank you