You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Craig Longman <cr...@begeek.com> on 2002/09/12 18:02:37 UTC

incorporating EL support

hi there,

i'm just starting out with jsp/taglibs, and have decided to focus on
using the jstl as the basis for my efforts.  it seems to provide exactly
what i needed, some basic, compatible tags to get started.

it is clear, however, that i'm going to have to write my own tags to get
any serious work done.

my question is this,  i figure that if i'm going to standardize on the
jstl, then it only makes sense to standardize on the EL stuff also, i
prefer its style to the scriplet thingies, and its less typing.  but,
i'm wondering what the preferred/recommended method is for doing this.

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

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

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

thanks,

-- 

    CraigL->Thx();
    Be Developer ID: 5852


Re: incorporating EL support

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Craig" == Craig Longman <cr...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: incorporating EL support

Posted by Ryan Lubke <Ry...@Sun.COM>.
On Thu, 2002-09-12 at 12:45, Craig Longman wrote:
> On Thu, 2002-09-12 at 12:14, peter lin wrote:
> > 
> > 
> > You should know that JSP2.0 includes EL built in.  the early access
> > implementation of JSP2.0 uses JSTL's el.
> 
> oh, ok.  well, that's good news.  i guess that splits my question into a
> couple pieces:
> 
> 1) jsp2.0 including EL, does that mean that the way one evaluates an EL
> parameter will change, or that explicit evaluation will no longer be
> necessary

If using JSP 2.0 EL machinery, then you will not have to perform
explicit evaluation in the tag library.  The container will take care
of this at runtime.

> 2) is there a way of determining ( in a tag ) to determine what the JSP
> level container we're executing in.  then the tag (during a phase-in
> period at least) could determine whether to explicitly evaluate it or
> not.
I think one approach is that if you don't want the container to evaluate
EL expressions, you can package the app using a Servlet 2.3 deployment
descriptor.  JSP 2.0 containers will not perform EL evaluation in that
case.  I also believe that if you use JSTL EL, and you want JSTL to
perform the EL evaluation you could also set a page property isELEnabled
to false and the container will not evaluate EL expressions.

I think there is a third option using a 2.4 deployment descriptor and
using a jsp-property-group to disable EL across a set of pages
identified by a URL pattern.

If you let the JSP 2.0 container evaluate the EL in a JSTL tag, then it
should be passed to JSTL as the evaluated value and you should have no
problems.

> 
> and a third question i suppose:
> 3) is explicitly evaluating EL really as simple as calling
> ExpressionEvaluatorManager.evaluate() (as below), or is there some other
> prep/setup work i haven't noticed yet in the bowels of the current jstl
> package?

Will defer to someone more familiar with the EL machinery.

> 
> > You may want to look at the draft spec to familiarize yourself with the
> > changes that will occur when JSP2.0 is released. 
> 
> i'll try and track it down, thanks.
> 
> > peter lin
> > 
> > Craig Longman wrote:
> > > 
> > > hi there,
> > > 
> > > i'm just starting out with jsp/taglibs, and have decided to focus on
> > > using the jstl as the basis for my efforts.  it seems to provide exactly
> > > what i needed, some basic, compatible tags to get started.
> > > 
> > > it is clear, however, that i'm going to have to write my own tags to get
> > > any serious work done.
> > > 
> > > my question is this,  i figure that if i'm going to standardize on the
> > > jstl, then it only makes sense to standardize on the EL stuff also, i
> > > prefer its style to the scriplet thingies, and its less typing.  but,
> > > i'm wondering what the preferred/recommended method is for doing this.
> > > 
> > > i see in the src dist for the reference jstl that there are a couple of
> > > classes that look promising to use.  one is an interface
> > > (ExpressionEvaluator) and then an implementing class
> > > (ExpressionEvaluatorManager).  using it appears to be as simple as this
> > > (from tag/el/core/ForEachTag.java):
> > > 
> > >   if( begin_ != null )
> > >   {
> > >     Object r = ExpressionEvaluatorManager.evaluate(
> > >                   "begin", begin_, Integer.class, this, pageContext );
> > >     if (r == null)
> > >     {
> > >       throw new NullAttributeException("forEach", "begin");
> > >     }
> > >     begin = ((Integer) r).intValue();
> > >     validateBegin();
> > >   }
> > > 
> > > it is acceptable to utilize this class in this manner for custom tags?
> > > or is there a better/standard way.  i have been unable to find any docs
> > > that talk about using the standard EL in your own tags, but if anyone
> > > has any pointers, i would greatly appreciate it.
> > > 
> > > thanks,
> > > 
> > > --
> > > 
> > >     CraigL->Thx();
> > >     Be Developer ID: 5852
> > > 
> > >   ------------------------------------------------------------------------
> > >                        Name: signature.asc
> > >    signature.asc       Type: application/pgp-signature
> > >                 Description: This is a digitally signed message part
> > 
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> > 
> -- 
> 
>     CraigL->Thx();
>     Be Developer ID: 5852
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: incorporating EL support

Posted by Craig Longman <cr...@begeek.com>.
On Thu, 2002-09-12 at 12:14, peter lin wrote:
> 
> 
> You should know that JSP2.0 includes EL built in.  the early access
> implementation of JSP2.0 uses JSTL's el.

oh, ok.  well, that's good news.  i guess that splits my question into a
couple pieces:

1) jsp2.0 including EL, does that mean that the way one evaluates an EL
parameter will change, or that explicit evaluation will no longer be
necessary
2) is there a way of determining ( in a tag ) to determine what the JSP
level container we're executing in.  then the tag (during a phase-in
period at least) could determine whether to explicitly evaluate it or
not.

and a third question i suppose:
3) is explicitly evaluating EL really as simple as calling
ExpressionEvaluatorManager.evaluate() (as below), or is there some other
prep/setup work i haven't noticed yet in the bowels of the current jstl
package?

> You may want to look at the draft spec to familiarize yourself with the
> changes that will occur when JSP2.0 is released. 

i'll try and track it down, thanks.

> peter lin
> 
> Craig Longman wrote:
> > 
> > hi there,
> > 
> > i'm just starting out with jsp/taglibs, and have decided to focus on
> > using the jstl as the basis for my efforts.  it seems to provide exactly
> > what i needed, some basic, compatible tags to get started.
> > 
> > it is clear, however, that i'm going to have to write my own tags to get
> > any serious work done.
> > 
> > my question is this,  i figure that if i'm going to standardize on the
> > jstl, then it only makes sense to standardize on the EL stuff also, i
> > prefer its style to the scriplet thingies, and its less typing.  but,
> > i'm wondering what the preferred/recommended method is for doing this.
> > 
> > i see in the src dist for the reference jstl that there are a couple of
> > classes that look promising to use.  one is an interface
> > (ExpressionEvaluator) and then an implementing class
> > (ExpressionEvaluatorManager).  using it appears to be as simple as this
> > (from tag/el/core/ForEachTag.java):
> > 
> >   if( begin_ != null )
> >   {
> >     Object r = ExpressionEvaluatorManager.evaluate(
> >                   "begin", begin_, Integer.class, this, pageContext );
> >     if (r == null)
> >     {
> >       throw new NullAttributeException("forEach", "begin");
> >     }
> >     begin = ((Integer) r).intValue();
> >     validateBegin();
> >   }
> > 
> > it is acceptable to utilize this class in this manner for custom tags?
> > or is there a better/standard way.  i have been unable to find any docs
> > that talk about using the standard EL in your own tags, but if anyone
> > has any pointers, i would greatly appreciate it.
> > 
> > thanks,
> > 
> > --
> > 
> >     CraigL->Thx();
> >     Be Developer ID: 5852
> > 
> >   ------------------------------------------------------------------------
> >                        Name: signature.asc
> >    signature.asc       Type: application/pgp-signature
> >                 Description: This is a digitally signed message part
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
-- 

    CraigL->Thx();
    Be Developer ID: 5852


Re: incorporating EL support

Posted by peter lin <pe...@labs.gte.com>.
the proposed final draft and early access implementation has been posted
on http://java.sun.com/products/jsp/

There's been a lot of activity on tomcat-dev dealing with JSP2.0. I have
no idea when it will be released. Perhaps one of the members in the
expert group can answer that question.

peter


Henri Yandell wrote:
> 
> Any idea on when we should expect JSP2.0 Peter?
> 
> Whether we all bother to EL things really depends on whether JSP2.0 is
> around the corner or not gonna happen til Spring 2004. Especially as we
> have to add in time for when we can expect JSP2.0 in servers.
> 
> Does Craig's code in anyway tie him to JSP 1.2? Or can you use
> ExpressionEvaluatorManager and its dependencies in JSP 1.1?
> 
> Hen
> 
> On Thu, 12 Sep 2002, peter lin wrote:
> 
> >
> >
> > You should know that JSP2.0 includes EL built in.  the early access
> > implementation of JSP2.0 uses JSTL's el.
> >
> > You may want to look at the draft spec to familiarize yourself with the
> > changes that will occur when JSP2.0 is released.
> >
> > peter lin
> >
> > Craig Longman wrote:
> > >
> > > hi there,
> > >
> > > i'm just starting out with jsp/taglibs, and have decided to focus on
> > > using the jstl as the basis for my efforts.  it seems to provide exactly
> > > what i needed, some basic, compatible tags to get started.
> > >
> > > it is clear, however, that i'm going to have to write my own tags to get
> > > any serious work done.
> > >
> > > my question is this,  i figure that if i'm going to standardize on the
> > > jstl, then it only makes sense to standardize on the EL stuff also, i
> > > prefer its style to the scriplet thingies, and its less typing.  but,
> > > i'm wondering what the preferred/recommended method is for doing this.
> > >
> > > i see in the src dist for the reference jstl that there are a couple of
> > > classes that look promising to use.  one is an interface
> > > (ExpressionEvaluator) and then an implementing class
> > > (ExpressionEvaluatorManager).  using it appears to be as simple as this
> > > (from tag/el/core/ForEachTag.java):
> > >
> > >   if( begin_ != null )
> > >   {
> > >     Object r = ExpressionEvaluatorManager.evaluate(
> > >                   "begin", begin_, Integer.class, this, pageContext );
> > >     if (r == null)
> > >     {
> > >       throw new NullAttributeException("forEach", "begin");
> > >     }
> > >     begin = ((Integer) r).intValue();
> > >     validateBegin();
> > >   }
> > >
> > > it is acceptable to utilize this class in this manner for custom tags?
> > > or is there a better/standard way.  i have been unable to find any docs
> > > that talk about using the standard EL in your own tags, but if anyone
> > > has any pointers, i would greatly appreciate it.
> > >
> > > thanks,
> > >
> > > --
> > >
> > >     CraigL->Thx();
> > >     Be Developer ID: 5852
> > >
> > >   ------------------------------------------------------------------------
> > >                        Name: signature.asc
> > >    signature.asc       Type: application/pgp-signature
> > >                 Description: This is a digitally signed message part
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
> >
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: incorporating EL support

Posted by Henri Yandell <ba...@generationjava.com>.
Any idea on when we should expect JSP2.0 Peter?

Whether we all bother to EL things really depends on whether JSP2.0 is
around the corner or not gonna happen til Spring 2004. Especially as we
have to add in time for when we can expect JSP2.0 in servers.

Does Craig's code in anyway tie him to JSP 1.2? Or can you use
ExpressionEvaluatorManager and its dependencies in JSP 1.1?

Hen

On Thu, 12 Sep 2002, peter lin wrote:

>
>
> You should know that JSP2.0 includes EL built in.  the early access
> implementation of JSP2.0 uses JSTL's el.
>
> You may want to look at the draft spec to familiarize yourself with the
> changes that will occur when JSP2.0 is released.
>
> peter lin
>
> Craig Longman wrote:
> >
> > hi there,
> >
> > i'm just starting out with jsp/taglibs, and have decided to focus on
> > using the jstl as the basis for my efforts.  it seems to provide exactly
> > what i needed, some basic, compatible tags to get started.
> >
> > it is clear, however, that i'm going to have to write my own tags to get
> > any serious work done.
> >
> > my question is this,  i figure that if i'm going to standardize on the
> > jstl, then it only makes sense to standardize on the EL stuff also, i
> > prefer its style to the scriplet thingies, and its less typing.  but,
> > i'm wondering what the preferred/recommended method is for doing this.
> >
> > i see in the src dist for the reference jstl that there are a couple of
> > classes that look promising to use.  one is an interface
> > (ExpressionEvaluator) and then an implementing class
> > (ExpressionEvaluatorManager).  using it appears to be as simple as this
> > (from tag/el/core/ForEachTag.java):
> >
> >   if( begin_ != null )
> >   {
> >     Object r = ExpressionEvaluatorManager.evaluate(
> >                   "begin", begin_, Integer.class, this, pageContext );
> >     if (r == null)
> >     {
> >       throw new NullAttributeException("forEach", "begin");
> >     }
> >     begin = ((Integer) r).intValue();
> >     validateBegin();
> >   }
> >
> > it is acceptable to utilize this class in this manner for custom tags?
> > or is there a better/standard way.  i have been unable to find any docs
> > that talk about using the standard EL in your own tags, but if anyone
> > has any pointers, i would greatly appreciate it.
> >
> > thanks,
> >
> > --
> >
> >     CraigL->Thx();
> >     Be Developer ID: 5852
> >
> >   ------------------------------------------------------------------------
> >                        Name: signature.asc
> >    signature.asc       Type: application/pgp-signature
> >                 Description: This is a digitally signed message part
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: incorporating EL support

Posted by peter lin <pe...@labs.gte.com>.

You should know that JSP2.0 includes EL built in.  the early access
implementation of JSP2.0 uses JSTL's el.

You may want to look at the draft spec to familiarize yourself with the
changes that will occur when JSP2.0 is released. 

peter lin

Craig Longman wrote:
> 
> hi there,
> 
> i'm just starting out with jsp/taglibs, and have decided to focus on
> using the jstl as the basis for my efforts.  it seems to provide exactly
> what i needed, some basic, compatible tags to get started.
> 
> it is clear, however, that i'm going to have to write my own tags to get
> any serious work done.
> 
> my question is this,  i figure that if i'm going to standardize on the
> jstl, then it only makes sense to standardize on the EL stuff also, i
> prefer its style to the scriplet thingies, and its less typing.  but,
> i'm wondering what the preferred/recommended method is for doing this.
> 
> i see in the src dist for the reference jstl that there are a couple of
> classes that look promising to use.  one is an interface
> (ExpressionEvaluator) and then an implementing class
> (ExpressionEvaluatorManager).  using it appears to be as simple as this
> (from tag/el/core/ForEachTag.java):
> 
>   if( begin_ != null )
>   {
>     Object r = ExpressionEvaluatorManager.evaluate(
>                   "begin", begin_, Integer.class, this, pageContext );
>     if (r == null)
>     {
>       throw new NullAttributeException("forEach", "begin");
>     }
>     begin = ((Integer) r).intValue();
>     validateBegin();
>   }
> 
> it is acceptable to utilize this class in this manner for custom tags?
> or is there a better/standard way.  i have been unable to find any docs
> that talk about using the standard EL in your own tags, but if anyone
> has any pointers, i would greatly appreciate it.
> 
> thanks,
> 
> --
> 
>     CraigL->Thx();
>     Be Developer ID: 5852
> 
>   ------------------------------------------------------------------------
>                        Name: signature.asc
>    signature.asc       Type: application/pgp-signature
>                 Description: This is a digitally signed message part

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>