Reusing Content in JSP Pages

There are many mechanisms for reusing JSP content in a JSP page. Three mechanisms that can be categorized as direct reuse—the include directive, preludes and codas, and the jsp:include element—are discussed here. An indirect method of content reuse occurs when a tag file is used to define a custom tag that is used by many Web applications. Tag files are discussed in the section Encapsulating Reusable Content Using Tag Files (page 573) in Chapter 15.

The include directive is processed when the JSP page is translated into a servlet class. The effect of the directive is to insert the text contained in another file— either static content or another JSP page—into the including JSP page. You would probably use the include ...

Get The J2EE™ Tutorial Second Edition 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.