O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The <jsp:include> standard action at first request

With the include standard action, there’s less work at translation time, and more work with each request, especially if the included file is a JSP.

  1. The client makes a request for Contact.jsp, which has not been translated. The Container reads the Contact.jsp page to start the translation process.

    image with no caption
  2. The container sees the include standard action, and uses that to insert a method call in the generated servlet code that—at runtime—will dynamically combine the response from Header.jsp into the response from Contact.jsp. The Container generates servlets for both JSP files. (This is not dictated by the spec, so we’re showing only an example of how it could work.)

    image with no caption
  3. The Container compiles the translated source file into a servlet class. It’s just like any other servlet at this point. The generated servlet class file is loaded into the Container’s JVM and is initialized. Next, the Container allocates a thread for the request and calls the JSP’s _jspService() method.

    image with no caption
  4. The Contact servlet hits the method that does the dynamic include, and something vendor-specific happens! All we care about is that the response generated by the Header servlet is combined ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required