This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes upon click of back button, go to logout page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "upon click of back button, go to logout page" Watch "upon click of back button, go to logout page" New topic
Author

upon click of back button, go to logout page

Robert Jack
Ranch Hand

Joined: Apr 13, 2010
Posts: 47
hi, i am new one of jsp,

i have developed simple web application...

Step 1 : I have one login page : (contains user-name ,password and submit button)

Step2 : I have one logout page : it has one link (Go to login page), just you
click this link go to login page..

step3 : And i have some pages like (page1,page2,page3, page4.....)

Normal application working following way :

After login comes page1..
Then click some action and it will go to page2
Then i click some action and it will goto page3
Then i click some action and it will goto page4

So now i am in page4...
now i click the back arrow in navigation tool-bar in
browser, generally go to previous page (page3).

For example... If you seeing mail in-box.... that time
you click back arrow..then automatically go to previous
page..


But i need , if i click back arrow in navigation tool-bar
(from any page in my application) ,then
go to logout page...

For example.... Suppose i am in page4... here i click backarrow in
browser then i want to go logout page, don't go to page3

how to achieve this...

Is there any possible....Any JavaScript or AnyOtherway

Please help me about this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

"Jack RobertJohn", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Robert Jack
Ranch Hand

Joined: Apr 13, 2010
Posts: 47
In my JSF application i use this following code ... but not work it...
And i also use session scope

public class LogoutPhaseListener implements PhaseListener
{
public void afterPhase(PhaseEvent event) { }

public void beforePhase(PhaseEvent event)
{
FacesContext facesContext = event.getFacesContext();
HttpServletResponse httpServletResponse = (HttpServletResponse)
facesContext.getExternalContext().getResponse();
httpServletResponse.addHeader("Pragma", "no-cache");
httpServletResponse.addHeader("Cache-Control", "no-cache");
httpServletResponse.addHeader("Cache-Control", "must-revalidate");
httpServletResponse.addHeader("Expires", "Mon, 8 Aug 2006 10:00:00 GMT");
httpServletResponse.addHeader("Cache-Control", "no-store");
}

public PhaseId getPhaseId()
{
return PhaseId.RENDER_RESPONSE;
}
}

If i click back button in browser, then it go to previous page...

but i want to go logout page..when i click back button in browser

http://stackoverflow.com/questions/2627155 :
i have take lot of effort this...but i can't achieve this...can you help me...any sample code or reference?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

"jack RobertJohn", my request that you check your private messages was not a suggestion. Please check your messages now.
 
Consider Paul's rocket mass heater.
 
subject: upon click of back button, go to logout page