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.
I have a problem that i have a servlet and a jsp page. This jsp page sends the parameters to servlet which then generates a graph. But the problem is that the graph is being displayed in the servlet and i have to go back to the jsp page to select other values. What i want is that when user selects a value and click on the button, then instead of displaying the chart in servlet, it should display in the jsp page. How can i achieve such functionality?
Bear Bibeault wrote:Your servlet shouldn't be generating the output. After it does the computations, it should forward to a JSP to create the display.
See this article for details on how to properly structure web applications.
But the problem is that the servlet is displaying the chart after taking values from a jsp, and i want to include that chart (whether as an image or the servlet is passed to another jsp, and that jsp is included in the previous jsp). How i am gonna achieve this?
Just write the JSP so that it can display the chart if it exists, but skip it if it doesn't. That way all the original controls are "repeated" on each view. Your servlet will simply forward to the same JSP.
(Although if you read the article, you might want to use the PRG pattern to avoid refresh problems.)
Joined: Aug 20, 2012
Well, i have read about request dispatcher. Will it be feasible in this situation? If so, how'll we achieve such functionality?