Is there any way in JSP by which we can find which page has sent the request. For e.g. if A.jsp has sent the request to B.jsp, By any API, can we find out in B that page A has sent the request?
Not reliably. Doing so would be a poor practice in any case. Why is this important?
If it's to switch some conditional processing, you should do that with an explicit parameter eather than rely upon some implicit knowledge such as "where did I come from?"
I can't think of any way to do it without inspecting the method stack or something.
There is great value in asking "can you do it questions." But I am curious as to what is driving you to ask the question in the first place. Might lead to something interesting.
(page1.jsp contained a link to page2.jsp in this case) hmm...it may be used for debugging...why not? but don't make any decisions inside your code using this value because you'll build dependency between pages in this way... so think a moment about Bear Bibeault's post...
1. The HTML page written by A.jsp has a link to B.jsp 2. A.jsp does an include of B.jsp 3. A.jsp does a forward to B.jsp 4. A.jsp does a redirect to B.jsp
Bill [ October 31, 2006: Message edited by: William Brogden ]