File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Refreshing jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Refreshing jsp page" Watch "Refreshing jsp page" New topic

Refreshing jsp page

vara prasad
Ranch Hand

Joined: Dec 21, 2004
Posts: 47
Hi Friends,

I found a problem in my jsp page. I written a code for registration form. This form takes details from the user. I am taking the these details through bean(storing this bean in the request object). I am validating in the bean and giving the validation errors to the same jsp page.

On succesfull validation i am sending the details to another jsp(<jsp:forward page="x.jsp" /> ), from where i am storing these details in database. these details are stored in database. O.K ....

Now the problem when user comes back to the registration form by using back button on Internet Explorer tool bar and pressing the refresh button the details once again going to the database.

How to avoid that? i don't have to use response.sendRedirect("x.jsp") there.
Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
You should look into using struts, as it sounds like your design correlates very strongly to how struts handles requests. Struts provides us with saveToken() and isTokenValid() methods. Here's how you can do it with jsp.

BTW, your token is put into the form as a hidden field.

[ August 13, 2005: Message edited by: Kerry Wilson ]
[ August 13, 2005: Message edited by: Kerry Wilson ]
SCJP 1.4
I agree. Here's the link:
subject: Refreshing jsp page
jQuery in Action, 3rd edition