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 BookShoppingServlet.java
... 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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.