aspose file tools*
The moose likes JSP and the fly likes macking backward button  false in browser window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "macking backward button  false in browser window" Watch "macking backward button  false in browser window" New topic
Author

macking backward button false in browser window

Amar Deep Singh Chaudhary
Ranch Hand

Joined: Dec 26, 2006
Posts: 49
hi ranchers !
i have created a login page in jsp and verify this login through a servlet.if login is successfull then it is redirects to another jsp.i have a problem when the new jsp is displayed then if i press the backward button of the browser then it comes on the login page.i want to create the application such that the back button of the browser not work to direct to the login page.i want to make that the back button of the browser is appear as disable.Please help me to make the disable the back button of the browser.
[ April 08, 2007: Message edited by: Bear Bibeault ]

"A thinking mind never dies"
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30309
    
150

Amar,
You cannot disable the back button in the user's browser.

You can set the page to "no cache" and display a different page if they choose to refresh it.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Topic Title: "Making backward button false in browser window"
My Question: "Is the button really backward that we need to make it false?"

Just kiddin.

Agreed with Jeanne.
Amar Deep Singh Chaudhary
Ranch Hand

Joined: Dec 26, 2006
Posts: 49
hi ranchers !
is anybody help me to making a page with no cache please give me some code example.it's urgent for me.
thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Two things to read:

First, see:
EaseUp to find out why adding the word "urgent" to your post or subject line can actually slow down or stop responses to your question altogether

Second, Have a look at our JSP Faq:
http://faq.javaranch.com/view?JspFaq
There, you will find a section devoted to showing you how to add no-cache directives to your pages.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Min Huang
Greenhorn

Joined: Sep 21, 2004
Posts: 16
If you put



at the top of your page, it will attempt to go forward a page in your history. If you go to another page, and then try to click back and go to this page, you will be bounced forward.

As an aside, if you do this, people will hate you. True story.

You probably want to use a servlet Filter to make the user go to the right page after authentication. Or use Acegi and let it do the hard work for you.


SCJP, SCJD, SCBCD, SCWCD
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61008
    
  65

Originally posted by Min Huang:
As an aside, if you do this, people will hate you. True story.


Yes, there's nothing like really annoying your user base with browser tricks that don't serve any real purpose to engender loyalty.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Min Huang:

As an aside, if you do this, people will hate you. True story.



Heh.

I started playing with this idea a while back.
I had read something similar a long time ago but couldn't find a link to it.
I never added a link for this one to any of the FAQ pages because I could never get it to sound "friendly" enough for JavaRanch.

Maybe somebody else can.
http://faq.javaranch.com/view?InterfaceDesignersRule1
Amar Deep Singh Chaudhary
Ranch Hand

Joined: Dec 26, 2006
Posts: 49
hi ranchers ! i want to use this java script function in my jsp page javascript:history.back().how i should use this function so that if any one want to go to back page i can invalidate my session.please give me some code example.so that as the user clicks on the backward button of the browser the session can be expired.Thanks in Advance.
Dhananjay Inamdar
Ranch Hand

Joined: Jan 27, 2003
Posts: 130
Hello Amar,

Please visit to this URL

http://www.javaworld.com/javaworld/jw-09-2004/jw-0927-logout.html

or

http://www.javaworld.com/javaworld/jw-10-2006/jw-1006-logout.html

I guess this will help you.


Just like you, struggeling to get the right solutions!<br /> <br />Sun Certified Java Programmer 1.5<br /> <br />Target - SCWCD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: macking backward button false in browser window