Hi everybody, I am Chaitanya, I working on a web project for our college. I have to maintain the college details so that everyone can access the details. I coded a
jsp page which asks the user to enter the department details. After successful submission, the details are transfered to a
servlet. There after that servlet transfers the details to a model and the details are inserted into a table. Then the servlet forwards the request to the same new_dept.jsp page
new_dept.jsp------->AddDept(servlet)--------->AddDeptModel(Model)---------------back to servlet---------->AddDept(Servlet)--------back to--------->new_dept.jsp
Then the same jsp page is sent to the client.
Here there is a problem. When the user refreshes the page an alert box is coming, saying the user that the page reloads and sends the previous data to the servlet again. iF THE USER SELECTS "OK" then the same details are sent to the servlet. So once again the same details are inserted into the database.
So I decided to forward the request to viewDepartments servlet like this.
Here again I am experiencing a problem. The viewDepartments servlet is a get request. Not a post request. The RequestDispatcher here is sending a post request to the servelt. Again I am getting an error saying the viewDepartment servlet cannot handle post request.
So I coded the viewDepartment servlet in service method. This should not be done. I know, but I dont have any alternative.
Please help me with this problem.
Thank you all in advance. Have a NICE DAY