132 CHAPTER 3: Best Practices in Java EE Web Development
The
The JSTL set tag or the
object. The
Set bean properties
Set Map values
Create scoped variables on the page, request, session, or application scope
Table 3-10 describes the attributes of the
Table 3-10.
Name Type Description
value Object Expression to be evaluated.
var String Name of the exported scoped variable to hold the value specified in the action.
scope String Scope for var.
target Object Target object whose property will be set. This must evaluate to a JavaBeans object
with the setter property property or to a java.util.Map object.
property String Name of the property to be set in the target object.
The
Set the value of a scoped variable in any JSP scope.
Set a property of a specified target object. The target must evaluate to a
JavaBean or Map object.
Setting the Value of a Scoped Variable in Any JSP Scope
One of the tasks of the
Here’s the syntax:
<c:set value=""value""var=""varName" " [scope=""{page|request|session|application}""]/>
Listing 3-36 shows an example of using
Listing 3-36. Using
Listing 3-36 creates an attribute named helloVar with the value "hello" in the default scope, which
is page scope. You can also create attributes in another scope, say session scope; in that case, you
need to specify the scope with
scope using