Hello all,
public class ReceiptServlet extends HttpServlet
{
public void doPut(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
// Process a customer's order
...
// Thank the customer for the order
res.setContentType("text/html");
PrintWriter toClient = res.getWriter();
...
toClient.println("Thank you for your order!");
// Get the request-dispatcher, to send an order-summary to the
client
RequestDispatcher summary =
getServletContext().getRequestDispatcher( "/OrderSummary");
// Have the servlet summarize the order; skip summary on error.
if (summary != null)
try {
summary.include(req, res);
} catch (IOException e) { }
catch (ServletException e) { }
toClient.println("Come back soon!");
toClient.println("</html>");
toClient.close();
}
}
Q1:-- Can anybody explain the how the OrderSummary servlet will be invoked
when we are using this code ?
Q2:--Suppose some html response is wriiten in OrderSummary servlet, then
how it is transfer to client. ( whether
it will be passed to client directly or through ReceiptServlet ( if
ReceiptServlet then how to get that html text) ) ?
The code is here
====================
RequestDispatcher summary = getServletContext().getRequestDispatcher(
"/OrderSummary");
// Have the servlet summarize the order; skip summary on error.
if (summary != null)
try {
summary.include(req, res);
}
Q3:--Do OrderSummary Servlet has different sesion from current servlet. ?
_____________________________________________________________
Visit http://www.PalmGreetings.com The first & only Mobile greeting site.
* You can send & receive e-cards using your Palm Pilot
* View animated cards on your Palm
* Draw your very own cards
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html