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.
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.

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.)

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.

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access