Learn Java for Web Development

(Tina Meador) #1

144 CHAPTER 3: Best Practices in Java EE Web Development


Listing 3-53. Using




value='${sessionScope.userName}'/>

<%-- body content --%>


The Action


The action builds a URL with the proper rewriting rules applied. It can format a URL and
store it in a variable specified by the var attribute.


Here’s the syntax without body content:


<c:url value [context] [var] [scope]/>


Here’s the syntax with body content to specify query string parameters:


<c:url value [context] [var] [scope]>


actions

   The only required attribute is value, which is the URL to be processed.
 <c:param> subtags can also be specified within the body of <c:url> for adding
to the URL query string parameters, which will be properly encoded if necessary.

The attributed of are listed in the Table 3-22.


Table 3-22. Attributes


Name Type Description

value String URL to be processed.
context String Name of the context when specifying a relative URL resource that belongs to a
foreign context.
var String Name of the exported scoped variable for the processed URL.
scope String Scope for var.

Listing 3-54 shows the simple usage of .


Listing 3-54. Using


Free download pdf