Java Reference
In-Depth Information
Listing 3-42 illustrates how to set bean properties using
<c:set>
.
Listing 3-42. Setting the bean property using the <c:set> Tag
<c:set target="book" property="book.title" value="Learning Java Web">
Listing 3-42 sets the
title
property of a bean named
book
to
Learning Java Web
. This is equivalent
to
book.setTitle("Learning Java Web");
.
The <c:remove>Action
The
<c:remove>
action removes a variable from a specific scope. The variables set by
<c:set>
in any
of the scopes can be removed using the
<c:remove>
action by specifying the variable name in the
var
attribute and the
scope
attribute.
Here's the syntax:
<c:remove var="varName"[scope="{page|request|session|application}"]/>
Table
3-11
describes the attributes of the
<c:remove>
action.
Table 3-11.
<c:remove> Attributes
Name
Type
Description
var
String
Name of the scoped variable to be removed
scope
Scope for
var
String
Listing 3-43 illustrates the simple usage of
<c:remove>
.
Listing 3-43. Using <c:remove>
<c:remove var=" helloVar " />
The <c:catch> Action
The
<c:catch>
action provides a way to catch
java.lang.Throwable
exceptions that are thrown by
any nested actions. This action has a single
var
attribute that holds a reference to any
java.lang.
Throwable
exceptions that occur during the execution of any of the nested actions.
Here is the syntax:
<c:catch [var="varName"]>
...nested actions in the body...
</c:catch>
Table
3-12
describes the attribute of the
<c:catch>
action.