Learn Java for Web Development

(Tina Meador) #1
CHAPTER 3: Best Practices in Java EE Web Development 141

Here is the output of Listing 3-48:


Clojure
Groovy
Java
Scala


URL-Related Actions


The URL-related actions are for linking, importing, and redirecting in web applications. Table 3-19
describes all the URL-related actions in the core library.


Table 3-19. URL-Related Actions


Action Purpose

<c:import> Imports the content of a URL-based resource.
<c:param> Adds request parameters to a URL. This is a nested action of <c:import>, <c:url>,
and <c:redirect>.
<c:url> Builds a URL with the proper rewriting rules applied.
<c:redirect> Sends an HTTP redirect to the client.

Let’s take a look at these URL-related actions.


The Action


The action imports the content of a URL-based resource, providing additional
functionality over the action. The syntax of the action is as follows:


<c:import url ="url [context="context"] [charEncoding="charEncoding"] [scope="application|page|requ
est|session"] [var= "varName"] >
Optional body content for sub tags



   The only required attribute is url, which is the URL of the resource to import.
 The <c:param> action, explained next, can be used as a nested tag in the body
content of the <c:import>.

Table 3-20 describes all the attributes used with the action.

Free download pdf