tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmk...@earthlink.net (David M. Karr)
Subject Re: incorporating EL support
Date Fri, 13 Sep 2002 04:44:19 GMT
>>>>> "Craig" == Craig Longman <craigl@begeek.com> writes:

    Craig> i see in the src dist for the reference jstl that there are a couple of
    Craig> classes that look promising to use.  one is an interface
    Craig> (ExpressionEvaluator) and then an implementing class
    Craig> (ExpressionEvaluatorManager).  using it appears to be as simple as this
    Craig> (from tag/el/core/ForEachTag.java):

    Craig>   if( begin_ != null )
    Craig>   {
    Craig>     Object r = ExpressionEvaluatorManager.evaluate(
    Craig>                   "begin", begin_, Integer.class, this, pageContext );
    Craig>     if (r == null)
    Craig>     {
    Craig>       throw new NullAttributeException("forEach", "begin");
    Craig>     }
    Craig>     begin = ((Integer) r).intValue();
    Craig>     validateBegin();
    Craig>   }

    Craig> it is acceptable to utilize this class in this manner for custom tags? 
    Craig> or is there a better/standard way.  i have been unable to find any docs
    Craig> that talk about using the standard EL in your own tags, but if anyone
    Craig> has any pointers, i would greatly appreciate it.

Another basically equivalent alternative is something like the following.  I
think I'm gravitating towards using ExpressionEvaluatorManager, instead of
ExpressionUtil, as shown here, because I'm just planning on ignoring null
values, which seems more efficient (at least from the POV of the interface) to
do with ExpressionEvaluatorManager and ExpressionUtil.  You treat null values
as an error, which is just a different approach.

        try {
            setArg0((String)ExpressionUtil.
                    evalNotNull("message", "arg0", getArg0(),
                                String.class, this, pageContext));
        } catch (NullAttributeException ex) {
            setArg0(null);
        }

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message