aspose file tools*
The moose likes JSP and the fly likes JSP not cached using jsp:forward from it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP not cached using jsp:forward from it " Watch "JSP not cached using jsp:forward from it " New topic
Author

JSP not cached using jsp:forward from it

Oscar Calderon
Ranch Hand

Joined: Nov 27, 2009
Posts: 32
Hi to all. I was reading the thread and i have a doubt about a problem that i have with my application related to jsp:forward use. In my application, when user logouts, i want to restrict that user sees the information when press Back browser button, so when user logouts i load a jsp that contains a piece of javascript with the next code:



And a jsp:forward tag that redirects to another jsp, lets say, threejsp.jsp. I expect that, when the user is in threejsp.jsp and press Back button, load the second jsp that contains the history.forward to return him to threejsp.jsp , but instead that it returns to the first jsp. My conclusions are that the second jsp isn't cached because goes from third jsp from first jsp and avoids second jsp.

I just wanna know if that situation is related to use jsp:forward and if that's the case, if exists a way to cache the jsp that uses jsp:forward


Wanna grow? Learn, live, love people and enjoy life
leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
i want to restrict that user sees the information when press Back browser button

Why do you want to mess with someone's broswer back button. Is it yours? Did you loan them that browser? Then don't do that.

When the user logs out, expire the session.

And a jsp:forward tag that redirects

There is a language barrier here.


Thanks, leo
Oscar Calderon
Ranch Hand

Joined: Nov 27, 2009
Posts: 32
And a jsp:forward tag that redirects

Ok i know that i wrote that bad, i mean
And a jsp:forward tag that forwards

About session, i delete all from session but doesn't matter, for example i'm seeing information about my user account, and press logout button, it forwards me to, let's say, logout.jsp , that contains a <jsp:forward tag that forwards to login.jsp.

Logout.jsp contains a javascript that automatically makes the same that does browser Forward button, so i hope that, when i'm in login.jsp and press the back button of the browser, it sends me to logout.jsp and because logout.jsp has that javascript code, it bounces me to login.jsp. But the problem is that it doesn't do that, back button sends me to the page where i was seeing information about my user account. Obviously, if inside it i press a link on the menu or something like that, user authentication logic is triggered and it redirects me to some page that indicates that my session has expired, but i dont'w want to permit that situation.

So it looks like the jsp that contains <jsp:forward isn't cached or something like that.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

You are confusing caching with history. JSP pages should never be cached, but the URLs are recorded in the history.

Also, remember that a forward is a server-side action and the browser knows nothing about it.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
What that means is that when you are looking at your page with user info, and your "logout button" forwards to logout.jsp, and that forwards to login.jsp, none of that page navigation happens in "your" browser. It happens at the server.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP not cached using jsp:forward from it