Learn Java for Web Development

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

Note The charEncoding attribute is required when accessing absolute URL resources where the protocol
is not HTTP and where the encoding is not ISO-8859-1.

The Action


The , , and actions explained later in this section all deal with URLs.
The action is used to pass request parameters and is used as a nested tag in the body
of either the , , or action. The action also does the URL
encoding.


Here’s the syntax with a parameter value specified in the attribute value.



Here’s the syntax with a parameter value specified in the body content.



parameter value

Table 3-21 describes the attributes of .


Table 3-21. Attributes


Name Type Description

name String Name of the query string parameter
value String Value of the parameter

Listing 3-52 illustrated how you can use instead of . You can also specify
request parameters for included files with the action, as shown in Listing 3-52.


Listing 3-52. Using




value='<%=session.getAttribute("userName")%>'/>

<%-- Page content goes here--%>


Listing 3-53 illustrates how you can use instead of .

Free download pdf