In building the Struts-EL tag library, I haven't ported Struts tags that
provide functionality that are directly supported in the JSTL.  However, in
some of those tags I haven't ported, I have noticed one small feature that
isn't strictly provided in their JSTL analogs.

The issue is "default values".  For instance, in the Struts "bean:cookie" tag,
it will assign the value of a cookie to a variable, but if the cookie isn't
defined, you can specify a default value that will be assigned to the variable.
There are a couple tags in the "bean" library that have this feature.

In the JSTL, there's no "quick" way to get this.  I believe, for each variable
that you want to have a default value, you'd do something like this, after
every "c:set" (perhaps) that reads a value you hope is defined:

 <c:if test="${empty variable}">
  <c:set var="variable" value="default value"/>
 </c:if>

(I guess this avoids the question of the difference between a null string and
an empty string.)

If I were to suggest an enhancement, it would be a "default" attribute on
"c:set" that can take an EL expression.  Is there any perception that this
might have enough value for a formal enhancement report?

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to