142 CHAPTER 3: Best Practices in Java EE Web Development
In the previous chapter, we saw how the
in one JSP page and include it in another; for example, you could include a header and footer as
illustrated in Listing 3-49.
Listing 3-49. Using the
<%-- content -%>
The
application as the including page and specified as a relative URL.
You can use
Listing 3-50 illustrates how to use
Listing 3-50. Using
<%-- content --%>
With the
also access external resources or resources in a foreign context. To access an external resource,
you specify an absolute URL for the url attribute, and to access a resource in a foreign context,
you specify a value for the context attribute that represents a context path for the foreign context
along with the url attribute, which represents a context-relative path to the resource. Listing 3-51
illustrates how to use the
Listing 3-51. Importing a Resource from a Foreign Context
Table 3-20.
Name Type Description
url String URL of the resource to import.
context String Name of the context when accessing a relative URL resource that belongs to a
foreign context.
var String Name of the exported scoped variable for the resource’s content.
scope String Scope for var.
charEncoding String Character encoding of the content at the input resource.
varReader String Name of the exported scoped variable for the resource’s content.