Java Reference
In-Depth Information
out.println("<TR>");
out.println(" <TD><INPUT TYPE='Radio'"
+ " NAME='Option' VALUE='Remove'>");
out.println(" <FONT COLOR=blue> " +
"Remove item from cart.</FONT></TD>");
out.println("</TR>");
out.println("<TR>");
out.println(" <TD><INPUT TYPE='Radio'"
+ " NAME='Option' VALUE='Next'>");
out.println(" <FONT COLOR=blue> "
+ "Choose next item.</FONT></TD>");
out.println("</TR>");
out.println("<TR>");
out.println(" <TD><INPUT TYPE='Radio'"
+ " NAME='Option' VALUE='Checkout'>");
out.println(" <FONT COLOR=blue> "
+ "Go to checkout.</FONT></TD>");
out.println("</TR>");
out.println("</TABLE>");
out.println("<BR><BR><BR>");
out.println("<INPUT TYPE='Submit'
VALUE='Submit'>");
out.println("</FORM>");
out.println("</CENTER>");
out.println("</BODY>");
out.println("</HTML>");
out.fl ush();
}
}
As an alternative to the use of sendRedirect to transfer control to another servlet (or
HTML page), we can create a RequestDispatcher object and call its forward method.
Example
RequestDispatcher requestDispatcher =
request.getRequestDispatcher("Checkout");
requestDispatcher.forward(request, response);
Provided that the user did not select 'Checkout' on the initial page [See later for
coverage of this], the Web page shown in Fig. 8.8 is presented. As can be seen, a
weight has been entered by the user.
Search WWH ::




Custom Search