Learn Java for Web Development

(Tina Meador) #1

134 CHAPTER 3: Best Practices in Java EE Web Development


Listing 3-42 illustrates how to set bean properties using .


Listing 3-42. Setting the bean property using the Tag



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 Action


The action removes a variable from a specific scope. The variables set by in any
of the scopes can be removed using the 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 action.


Table 3-11. Attributes


Name Type Description

var String Name of the scoped variable to be removed
scope String Scope for var

Listing 3-43 illustrates the simple usage of .


Listing 3-43. Using



The Action


The action provides a way to catch java.lang.Throwableexceptions 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...



Table 3-12 describes the attribute of the action.

Free download pdf