tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (David M. Karr)
Subject Re: incorporating EL support
Date Fri, 13 Sep 2002 04:44:19 GMT
>>>>> "Craig" == Craig Longman <> 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/

    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 {
                    evalNotNull("message", "arg0", getArg0(),
                                String.class, this, pageContext));
        } catch (NullAttributeException ex) {

David M. Karr          ; Java/J2EE/XML/Unix/C++

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message