Sample Program: Writing a Servlet Chain for the BookShoppingServlet

Listing 4.1 contains snippets of the BookShoppingServlet code for initializing the ServletContext object, adding the new Checkout button to the View Cart page, and servlet chaining. The BookCheckOutServlet will be listed completely and explained in detail later.

Listing 4.1. Code Snippets for
 ... public void init(ServletConfig config) throws ServletException { super.init(config); sc = getServletConfig().getServletContext(); ... }//end of init ... public void doSessionUsingHttpSession(PrintWriter outputObject, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ ... if(clickedButton.equals("view")) { ... //changed here ...

Get Sams Teach Yourself BEA WebLogic Server 7.0™ in 21 Days now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.