Originally posted by sreeni san:
Is there a way to know as to which servlet sent the request.
In other words,
Servlets don't send requests, browsers (or other web clients) do.
Browsers don't know that the page which is currently loaded is the result of servlet (or
JSP page, or PHP page, or ASP....).
In other words, unless you add something to the link or form that will be used to generate the next request, the server will have no way of knowing how the previous page was built.
The referer header only tells you what the URL for the last page was.
In
J2EE apps this isn't always helpful. Servlets and JSPs often have url-mappings that have nothing to do with the actual servlet names.
If this is important to you, follow Dilip Kumar Jain's advice and add a hidden form field or query
string variable to each form/link in your app.