jeudi 29 janvier 2015

Refreshing a JSP form resubmits the data

I have a jsp page called patient.jsp with a Form which is a pop-up. This form is submitted using post method. Once this form reached the servlet, something like below take place.



request.setAttribute("id",id);
RequestDispatcher dispatch = getServletContect().getRequestDispatcher("/patient.jsp");
dispatch.forward(request,response);


There is a big problem. Once this is forwarded back to the patient.jsp, if the user refresh the web page, everything he previously entered into the forms will be resubmitted and saved in the database.


We used RequestDispatcher because we have to pass an attribute from Request scope. Any idea how to solve this?





Aucun commentaire:

Enregistrer un commentaire