This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com