tags:

views:

158

answers:

2

Is there a way to get the URI of a JSP that sent a particular GET/POST request to a Servlet? I know of the request.getRequestURI() function within a Servlet, but that is just returning the URI of the Servlet itself.

For example:

Let's say that index.jsp sent the request to the Servlet SampleServlet. I want to get the URI of the index.jsp file. I haven't found a way to do it, any help would be appreciated.


Edit:

For those curious, it's just request.getHeader('referer');. Thanks to Vinay Sajip for that!

A: 

Use the Referer header from the incoming request.

Vinay Sajip
Awesome, didn't know that existed. Thanks!
Adam Mika
A: 

Why not just have the JSP add the current URL as a value in the request scope before forwarding to or including the servlet?

Chase