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.
Hi, I would like to know how could the following be done If i have a jsp page and want to transfer control to a servlet1 perform some processing there and then transfer control to servlet2 perfrom some computations there then take the data from servlet2 and servlet1 and transfer it to the jsp page.Could some one help me please
Using the <servlet> tag in web.xml, declare both servlet1 and servlet2. Using the <servlet-mapping> tag in web.xml, give each servlet it's own URL. Have the starting JSP/HTML contain servlet1's URL as it's action. Once processing in servlet1 is done, get a RequestDispatcher using the URL for servlet2 and forward. Once servlet2 is done it's work, get a RequestDispatcher using the URL of the servlet you want to display as the final JSP. Think of each JSP getting it's own implicit <servlet> and <servlet-url> tag. The RequestDispatcher allows you to send a request to any resource, declared explicitly or implicitly.
Joined: Oct 31, 2002
how do i pass the data got from servlet2 back to servlet1 and then data from servlet1 and servlet2 back to jsp in a request dispatcher am i suppose to use request.setattributes()method to do tht