User enters data in jsp A which sends it to servlet B which sends the new data along with the old data (kind of like updating a datagrid) to jsp C to display the data. Now everything is okay but if the user presses refresh a message saying "will need to resend data press ok to continue" or something like that is shown in the browser and a new record is added to the DB how can i handle the refresh issue. From what i understand is the servlet called the page using getrequestdispatcher and forwards the page so the url stays the same as that of jspA rite ???. Should i use sendredirect here will that solve the problem if so what abt the attributes of the response object servlet sends to jsp C they will be erased in case of sendredirect and i dont want to add them to session. Any suggestions ??
I guess i am already (sort of ) using this pattern but i do have a question at the end. Let me just re-explain my scenario - User fills a form in JSP Page A the form posts the data to servlet B. The servlet B processes the data and forwards it to a JSP page B. The Pattern however suggests that Servlet B should redirect and not forward to page B. To avoid the "how do i disable refresh" issue. This mechanism will work well for me , however the only thing is servletB adds a couple of attributes before it forwards the request object to page C and if i redirect directly from servlet B to page C I wont have those attribute available. The pattern also suggests that I introduce a page controller (servlet) the purpose of which i didnt really get. But currently the order followed in my code is
With the pageController its going to be as follows (here is the question)
PageA(posts)->PageControllerServlet(Q.What would this do?Will this process the received data from the jsp page)(Redirects)->ServletB(forwards)->PageC