Java Reference
In-Depth Information
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 <c:param>Action
The <c:import> , <c:url> , and <c:redirect> actions explained later in this section all deal with URLs.
The <c:param> action is used to pass request parameters and is used as a nested tag in the body
of either the <c:import> , <c:url> , or <c:redirect> action. The <c:param> action also does the URL
encoding.
Here's the syntax with a parameter value specified in the attribute value .
<c:param name="name" value="value"/>
Here's the syntax with a parameter value specified in the body content.
<c:param name="name">
parameter value
</c:param>
Table 3-21 describes the attributes of <c:param> .
Table 3-21. <c:param> 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 <c:import> instead of <jsp:include> . You can also specify
request parameters for included files with the <jsp:param> action, as shown in Listing 3-52.
Listing 3-52. Using <jsp:param>
<body>
<jsp:include page='/WEB-INF/jsp/company/companyHeader.jsp'>
<jsp:param name='user'
value='<%=session.getAttribute("userName")%>'/>
</jsp:include>
<%-- Page content goes here--%>
<jsp:include page='/WEB-INF/jsp/company/companyFooter.jsp'/>
</body>
Listing 3-53 illustrates how you can use <c:param> instead of <jsp:param> .
 
 
Search WWH ::




Custom Search