Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Back Button

  Asked By: Lourdes    Date: Aug 18    Category: Java    Views: 725
  

I want to disable the back button of the browser in my web
application. I am using the struts framework for the MVC design
pattern. How can I do it? Can anybody help me? Should I change in my JSPs?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Doyle Gonzalez     Answered On: Aug 18

<SCRIPT LANGUAGE="JavaScript">

function goNewWin() {

//***Get what is below onto one line***

window.open("backbuttonnewpage.html",'TheNewpop','toolbar=1,
location=1,directories=1,status=1,menubar=1,
scrollbars=1,resizable=1');

//***Get what is above onto one line***

self.close()

}

</SCRIPT>

 
Answer #2    Answered By: Balbir Kaur     Answered On: Aug 18

You can achieve this by using token feature in Struts:



public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionMessages errors = new ActionMessages();
if (!isTokenValid(request)) {
errors.add("error.duplicaterequest", new ActionMessage("error.duplicaterequest"));
}
resetToken(request);
if (!errors.isEmpty()) {
saveErrors(request, errors);
saveToken(request);
return (mapping.getInputForward());
}
return mapping.findForward("success");
}

 
Answer #3    Answered By: Rene Sullivan     Answered On: Aug 18

You should probably either prevent the page from being cached or clear the browser's history.

 
Didn't find what you were looking for? Find more on Back Button Or get search suggestion and latest updates.




Tagged: