Hallo,
I'm new in Java and servlets and have read in this and other lists that chaining 
servlets is no good programming style.

My question is: what exactly is servlet-chaining?

Here is some code of the Sun's bookstore example.

public class BookStoreServlet extends HttpServlet {

    public void service (HttpServletRequest request,
                         HttpServletResponse response)
        throws ServletException, IOException
    {

        [snip]

        //Left cell -- the "book of choice"
        out.println("<td valign=\"TOP\" width=\"55%\">" +
                    "<h3>What We're Reading</h3>" +
                    "<p>" +
                    "In <em><a href=\"" +
                    response.encodeUrl("/servlet/bookdetails?bookId=203")
        [snip]

In the last two lines the servlet BookDetails can be called from the site generated by 
the BookStoreServlet
Is this meant by chaining servlets???

Or is it something like this (also from the Sun example):

public class BookDetailServlet extends HttpServlet {

    public void doGet (HttpServletRequest request,
                       HttpServletResponse response)
        throws ServletException, IOException
    {

        [snip]

        //Get the identifier of the book to display
        String bookId = request.getParameter("bookId");
        if (bookId != null) {

            // and the information about the book
            BookDBServlet database = (BookDBServlet)
                getServletConfig().getServletContext().getServlet("bookdb");
                       BookDetails bd = database.getBookDetails(bookId);
         [snip]

In the last lines the servlet BookDetailServlet calls a method of the BookDBServlet.

Or is it something totally different.

Can anyone please explain what servlet-chaining is and why I shouln't use it.
Thanks

Guido

___________________________________________________________________________
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

Reply via email to