FileDocCategorySizeDatePackage
NileBooks.javaAPI DocExample1060Thu Apr 05 21:28:48 BST 2001None

NileBooks

public class NileBooks extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)

    res.setContentType("text/html");
    PrintWriter out = res.getWriter();

    out.println("<HTML><HEAD><TITLE>Welcome to Nile</TITLE></HEAD>");
    out.println("<BODY>");

    // Show items in an online catalog
    RequestDispatcher dispatcher =
      req.getRequestDispatcher("/servlet/NileItem");

    out.println("Feast your eyes on this beauty:");
    req.setAttribute("item", Book.getBook("156592391X"));
    dispatcher.include(req, res);

    // Remove the "item" attribute after use
    req.removeAttribute("item");

    out.println("Or how about this one:");
    req.setAttribute("item", Book.getBook("0395282659"));
    dispatcher.include(req, res);

    out.println("And, since I like you, they're all 20% off!");

    out.println("</BODY></HTML>");