I have developed 4 jsp pages , and they should be accessed in sequence . Is there a way to stop user to go back ? can I give a prompt also when user tries to go back
Asked
Active
Viewed 696 times
1
-
could you please share sequence how you are calling – Musaddique S Feb 07 '16 at 08:56
-
The sequence is , for example, A.jsp -> B.jsp -> C.jsp -< D.jsp , with file upload at B.jap and form input at C.jsp. – Swapnil Shrivastava Feb 07 '16 at 11:34
-
tried response.setHeader("Cache-Control","no-cache"); , but still I can go back to earlier page – Swapnil Shrivastava Feb 08 '16 at 16:52
1 Answers
0
You can stop the user from going back to previous page by disabling the back button via JavaScript. But it will not solve the issue completely as user can use the URL and can put it in address bar if the URL is changing in case sendRedirect method.
In addition to that for a user you can maintain some counter representing the page in your application on which user can go.if user hits the URL then you can do a server side validation if the page is the correct page or not.
If the page requested is not the correct page of the sequence then do the redirection on correct page.
You can try the combination of forward and disabling the back-button.
For reference
how to stop browser back button using javascript

Narendra Jaggi
- 1,297
- 11
- 33