It�s strange to note that when I�m forwarding (a RequestDispatcher forward() call) the request after storing attribute in the session (in page1.jsp); every time when I open a new browser window and directly try to access page2.jsp I don�t get redirected to the login page, but, when I do a redirection form page1.jsp, and then I open a new browser window (trying to access page2.jsp), I get redirected to the login page.
I know that the basic difference between a redirect and a forward is that the former makes a roundtrip to the server, whereas, a forward call does a request forwarding at the server end and the address bar of the browser window remains unchanged.
But, I still don�t get that why Server Side Forwarding is not working here.
If so you're starting a new session with each request to the server.
Put the following tag in each of your JSPs and compare your session ID.
The LiveHTTPHeaders plugin for Firefox is also a nice tool for debugging these types of issues.
I have a simple bean that I�m storing in a session (say- page1.jsp) and then forwarding the request to another web component (say- page2.jsp); wherein I�m checking for the session attribute. In case the attribute is not found, I�m redirecting the client to the login page (say- login.jsp).
Can you post that part(s) of your code where you are doing this logic
Following is the simple code i'm using:
My query is that when I do a RequestDispatcher.forward() call, each request looks like a new one (cause I get nulls in the showCart.do resource). However, sendRedirect() works well.
Any help shall be highly appreciated.