December 2003
Intermediate to advanced
764 pages
24h 58m
English
An alternative to the <jsp:setProperty>
standard action is the JSTL
<c:set>
action:
...
<c:set target="${msg}" property="category" value="thoughts" />
...
<c:set target="${msg}" property="category" value="quotes" />
...The target attribute contains an EL expression
that evaluates to the bean, the property attribute
specifies the property name (as a static string or as an EL
expression), and the value attribute contains the
value (as a static string or as an EL expression).
As with the choice between <jsp:getProperty>
and an EL expression for reading a property value, using
<jsp:setProperty> or
<c:set> is largely a matter of preference.
The <c:set> action is more flexible as
you’ll see later, so as long as you
don’t need to be JSP 1.1 compatible, it should be
your first choice.
Read now
Unlock full access