This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes clear the field and disable the back button. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "clear the field and disable the back button." Watch "clear the field and disable the back button." New topic
Author

clear the field and disable the back button.

Rush Shah
Greenhorn

Joined: Oct 16, 2010
Posts: 6
hi,

I need to clear the field when i navigate from one screen to other and disable the back button.
example; index.jsp--->servlet1;

problem1;

on index.jsp i have two field say x and y which takes number as input from user.
when i click on the submit button it goes to servlet1.when i click on back button the previously entered data is still visible in two field x and y.

i try the below solution for the same but it is not working.



i am using tomcat as server.is there any configuration required at server side?

problem 2;

how to disable the back button in browser?
i try the below solution for the same but it is not working.





please help me out.


Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Rush,
Welcome to JavaRanch!

#1 - Are you using GET or POST to display X? If the later, the technique you described should work. However, you shouldn't use POST just to avoid the user going back. It results in an annoying website where one can't go back to anything and gives up. What's the harm in the user going back to that page.

#2 - This is easy. You can't disable the back button in any reliable way. it is a feature of the user's browser.


[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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60798
    
  65

Please read InterfaceDesignersRule1


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rush Shah
Greenhorn

Joined: Oct 16, 2010
Posts: 6
Jeanne Boyarsky/Bear Bibeault thanks for the reply.

Problem 1 : I have try using both Post and Get the fields are not getting cleared.

Problem 2: secondly I have gone through the InterfaceDesignersRule1 ,
The requirnment in my application is
1)when user click on any screen using browser back button then it user must see 404 or error page

2)There is seperate back button provided in application using which only the
user can go back.

Please help me out for the above problems fix.








 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: clear the field and disable the back button.
 
Similar Threads
Ajax, Struts, and a few pesky event based issues
not able to call javascript function on onlcick
Having trouble with a javascript assignment
How to perform operations like insert,delete,add,move next etc in jsp page?
Is my code running twice? JSP, java beans, db updates - strange happenings