You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Stephenson Tim <Ti...@iie.qld.gov.au> on 2002/04/02 09:52:46 UTC

anyone care to clarify difference between struts and JSTL?

hi all, 

i have taken a stroll through the mail archive and not found any clear
definition of what is the difference between the struts taglibs and the
'standard' taglibs. 

let me admit first that i am completely new to JSTL, what i really want to
know is should i keep going with struts tags (which i find very powerful) or
is everyone about to switch directions?

it seems to me that some tags are overlaps such as the logic tags with what
appears to be called 'core' condition tags.

and some others have been deliberately (and i believe wisely) excluded on
grounds on breaking MVC (eg JSTL sql tags)

i would be interested in your views especially in whether you guys see a
future amalgamation of some or any of the struts tags into JSTL. 

rgds,tim 

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


Re: anyone care to clarify difference between struts and JSTL?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 2 Apr 2002, Stephenson Tim wrote:

> and some others have been deliberately (and i believe wisely) excluded on
> grounds on breaking MVC (eg JSTL sql tags)
>

On this particular point, here's what I told the Struts BOF audience at
JavaOne:

    "Shame on you if you use the SQL tags in your
    presentation tier directly"

These tags exist because there are valid use cases (prototyping, quick
and dirty "guest book sized" apps, conversions of VB or Cold Fusion apps,
and so on).  But we Struts users know that none of those use cases match
up with creating scalable, maintainable, MVC-based designs.

All the rest of the JSTL tags are good stuff.

Craig



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


Re: anyone care to clarify difference between struts and JSTL?

Posted by Martin Cooper <ma...@tumbleweed.com>.
----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: "Struts Developers List" <st...@jakarta.apache.org>
Sent: Saturday, April 06, 2002 5:15 PM
Subject: Re: anyone care to clarify difference between struts and JSTL?


>
>
> On 3 Apr 2002, David M. Karr wrote:
>
> > Date: 03 Apr 2002 16:41:53 -0800
> > From: David M. Karr <dm...@earthlink.net>
> > Reply-To: Struts Developers List <st...@jakarta.apache.org>
> > To: Struts Developers List <st...@jakarta.apache.org>
> > Subject: Re: anyone care to clarify difference between struts and JSTL?
> >
> > >>>>> "Craig" == Craig R McClanahan <cr...@apache.org> writes:
> >
> >     Craig> My advice to Struts users is as follows:
> >
> >     Craig> * If you're running on a Servlet 2.2 / JSP 1.1 container, you
> >     Craig>   will not be able to use JSTL (it requires Servlet 2.3 / JSP
1.2).
> >     Craig>   Go ahead and continue using the Struts tag libraries.
> >
> >     Craig> * If you're running on a Servlet 2.3 / JSP 1.2 container, you
> >     Craig>   should begin experimenting with JSTL.  There is no problem
in
> >     Craig>   using both JSTL and Struts tags in the same page (although,
> >     Craig>   obviously, the expression syntax is different).
> >
> >     Craig> * Over time, I plan to add a few features to the Struts tags
to
> >     Craig>   ease migration to JSTL for the "bean" and "logic"
libraries --
> >     Craig>   for example, I want to support the same expression
language, and
> >     Craig>   attribute names where that is possible.
> >
> >     Craig> * Longer term, I suggest that page developers plan on using
the JSTL
> >     Craig>   tags in their applications, as quickly as it is feasible
for you
> >     Craig>   to do so.  But we're not going to throw away the existing
Struts
> >     Craig>   tags any time soon, so they will continue to be available.
> >
> >     Craig> (One other note -- the expression language itself will become
part of JSP
> >     Craig> 1.3, so you'll be able to use it in template text as well as
in custom tag
> >     Craig> attribute values.)
> >
> > It would seem reasonable to consider doing what the JSTL implementors
did,
> > which is creating two sets of tag libraries, one using the EL, and one
using
> > scriptlets.  As it's logical to assume that the default for the JSTL is
the EL,
> > and not RT, for each TLD, they created a "-rt" version and a non-rt
version,
> > which assumes the EL.  In the case of Struts, you would probably want
the
> > "default" to be the RT library, and for the "-el" library to be
optional.  By
> > making both of these available at the same time, it allows people to
fully
> > experiment with both alternatives.  This would only be worthwhile during
the
> > transition.  Later releases wouldn't need this.
> >
>
> I was actually thinking of a slightly different approach -- for each
> Struts tag that accepts the name/property/scope triplet of attributes,
> create a new attribute like "expr" that accepts an expression language
> expression instead.  I believe this will be easier to understand, because
> the EL expression actually covers all three of these concepts, so it
> wouldn't really make sense to interpret any of the existing attributes in
> two different ways.
>
> Doing this would seem to avoid the need for dual libraries.  Does that
> make sense?

This makes sense for the set of attributes you mention, but I have a feeling
that the end result might be confusing for people. The problem is that it
only provides for the use of the EL for that particular set of attributes.
Other attributes that currently allow RTexpr values would still only allow
RTexpr values, so people would have to combine the use of both the EL and
RTexpr values for each tag instance (if they wanted to use the EL at all,
that is).

I actually think that addressing this would head us down the same path that
I believe the JSTL EG followed in their discussions. To allow the use of the
EL for other attributes, I recall one idea pursued by the EG was to allow
for attribute variants. For example, if there was an attribute 'foo', there
would be a parallel attribute 'foo_', where the former used RTexpr and the
latter used the EL. At some point, that approach was discarded in favour of
dual taglibs.

It seems to me that the same approach would be logical for the Struts
taglibs, and probably for the same reasons that the JSTL EG made their
decision. What do you think?

--
Martin Cooper


>
> > --
> > ===================================================================
> > David M. Karr          ; Java/J2EE/XML/Unix/C++
> > dmkarr@earthlink.net
> >
>
> Craig
>
>
> --
> 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: anyone care to clarify difference between struts and JSTL?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On 6 Apr 2002, David M. Karr wrote:

> Date: 06 Apr 2002 20:38:38 -0800
> From: David M. Karr <dm...@earthlink.net>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: Re: anyone care to clarify difference between struts and JSTL?
>
> >>>>> "Craig" == Craig R McClanahan <cr...@apache.org> writes:
>
>     >> It would seem reasonable to consider doing what the JSTL implementors did,
>     >> which is creating two sets of tag libraries, one using the EL, and one using
>     >> scriptlets.  As it's logical to assume that the default for the JSTL is the EL,
>     >> and not RT, for each TLD, they created a "-rt" version and a non-rt version,
>     >> which assumes the EL.  In the case of Struts, you would probably want the
>     >> "default" to be the RT library, and for the "-el" library to be optional.  By
>     >> making both of these available at the same time, it allows people to fully
>     >> experiment with both alternatives.  This would only be worthwhile during the
>     >> transition.  Later releases wouldn't need this.
>     >>
>
>     Craig> I was actually thinking of a slightly different approach -- for each
>     Craig> Struts tag that accepts the name/property/scope triplet of attributes,
>     Craig> create a new attribute like "expr" that accepts an expression language
>     Craig> expression instead.  I believe this will be easier to understand, because
>     Craig> the EL expression actually covers all three of these concepts, so it
>     Craig> wouldn't really make sense to interpret any of the existing attributes in
>     Craig> two different ways.
>
>     Craig> Doing this would seem to avoid the need for dual libraries.  Does that
>     Craig> make sense?
>
> One reason I thought dual libraries would be logical is that the JSTL requires
> JSP 1.2 (correct?).  In order for Struts to still allow using JSP 1.1, don't we
> need to have a library available which doesn't use the EL at all?
>

JSTL does indeed require JSP 1.2.  That doesn't mean that this is needed
to implement the expression language, however.  In fact, I talked with
Shawn Bayern (primary developer on JSTL) and the plan is to separate the
EL implementation into a Commons component that can be reused in several
other places.  So, we can include commons-el.jar (or whatever it ends up
getting called) and have EL support in our own tags that is functionally
compatible with the EL in JSTL -- even if you don't actually have JSTL
present in your webapp.

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

Craig


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


Re: anyone care to clarify difference between struts and JSTL?

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Craig" == Craig R McClanahan <cr...@apache.org> writes:

    >> It would seem reasonable to consider doing what the JSTL implementors did,
    >> which is creating two sets of tag libraries, one using the EL, and one using
    >> scriptlets.  As it's logical to assume that the default for the JSTL is the EL,
    >> and not RT, for each TLD, they created a "-rt" version and a non-rt version,
    >> which assumes the EL.  In the case of Struts, you would probably want the
    >> "default" to be the RT library, and for the "-el" library to be optional.  By
    >> making both of these available at the same time, it allows people to fully
    >> experiment with both alternatives.  This would only be worthwhile during the
    >> transition.  Later releases wouldn't need this.
    >> 

    Craig> I was actually thinking of a slightly different approach -- for each
    Craig> Struts tag that accepts the name/property/scope triplet of attributes,
    Craig> create a new attribute like "expr" that accepts an expression language
    Craig> expression instead.  I believe this will be easier to understand, because
    Craig> the EL expression actually covers all three of these concepts, so it
    Craig> wouldn't really make sense to interpret any of the existing attributes in
    Craig> two different ways.

    Craig> Doing this would seem to avoid the need for dual libraries.  Does that
    Craig> make sense?

One reason I thought dual libraries would be logical is that the JSTL requires
JSP 1.2 (correct?).  In order for Struts to still allow using JSP 1.1, don't we
need to have a library available which doesn't use the EL at all?

-- 
===================================================================
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: anyone care to clarify difference between struts and JSTL?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On 3 Apr 2002, David M. Karr wrote:

> Date: 03 Apr 2002 16:41:53 -0800
> From: David M. Karr <dm...@earthlink.net>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: Struts Developers List <st...@jakarta.apache.org>
> Subject: Re: anyone care to clarify difference between struts and JSTL?
>
> >>>>> "Craig" == Craig R McClanahan <cr...@apache.org> writes:
>
>     Craig> My advice to Struts users is as follows:
>
>     Craig> * If you're running on a Servlet 2.2 / JSP 1.1 container, you
>     Craig>   will not be able to use JSTL (it requires Servlet 2.3 / JSP 1.2).
>     Craig>   Go ahead and continue using the Struts tag libraries.
>
>     Craig> * If you're running on a Servlet 2.3 / JSP 1.2 container, you
>     Craig>   should begin experimenting with JSTL.  There is no problem in
>     Craig>   using both JSTL and Struts tags in the same page (although,
>     Craig>   obviously, the expression syntax is different).
>
>     Craig> * Over time, I plan to add a few features to the Struts tags to
>     Craig>   ease migration to JSTL for the "bean" and "logic" libraries --
>     Craig>   for example, I want to support the same expression language, and
>     Craig>   attribute names where that is possible.
>
>     Craig> * Longer term, I suggest that page developers plan on using the JSTL
>     Craig>   tags in their applications, as quickly as it is feasible for you
>     Craig>   to do so.  But we're not going to throw away the existing Struts
>     Craig>   tags any time soon, so they will continue to be available.
>
>     Craig> (One other note -- the expression language itself will become part of JSP
>     Craig> 1.3, so you'll be able to use it in template text as well as in custom tag
>     Craig> attribute values.)
>
> It would seem reasonable to consider doing what the JSTL implementors did,
> which is creating two sets of tag libraries, one using the EL, and one using
> scriptlets.  As it's logical to assume that the default for the JSTL is the EL,
> and not RT, for each TLD, they created a "-rt" version and a non-rt version,
> which assumes the EL.  In the case of Struts, you would probably want the
> "default" to be the RT library, and for the "-el" library to be optional.  By
> making both of these available at the same time, it allows people to fully
> experiment with both alternatives.  This would only be worthwhile during the
> transition.  Later releases wouldn't need this.
>

I was actually thinking of a slightly different approach -- for each
Struts tag that accepts the name/property/scope triplet of attributes,
create a new attribute like "expr" that accepts an expression language
expression instead.  I believe this will be easier to understand, because
the EL expression actually covers all three of these concepts, so it
wouldn't really make sense to interpret any of the existing attributes in
two different ways.

Doing this would seem to avoid the need for dual libraries.  Does that
make sense?

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

Craig


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


Re: anyone care to clarify difference between struts and JSTL?

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Craig" == Craig R McClanahan <cr...@apache.org> writes:

    Craig> My advice to Struts users is as follows:

    Craig> * If you're running on a Servlet 2.2 / JSP 1.1 container, you
    Craig>   will not be able to use JSTL (it requires Servlet 2.3 / JSP 1.2).
    Craig>   Go ahead and continue using the Struts tag libraries.

    Craig> * If you're running on a Servlet 2.3 / JSP 1.2 container, you
    Craig>   should begin experimenting with JSTL.  There is no problem in
    Craig>   using both JSTL and Struts tags in the same page (although,
    Craig>   obviously, the expression syntax is different).

    Craig> * Over time, I plan to add a few features to the Struts tags to
    Craig>   ease migration to JSTL for the "bean" and "logic" libraries --
    Craig>   for example, I want to support the same expression language, and
    Craig>   attribute names where that is possible.

    Craig> * Longer term, I suggest that page developers plan on using the JSTL
    Craig>   tags in their applications, as quickly as it is feasible for you
    Craig>   to do so.  But we're not going to throw away the existing Struts
    Craig>   tags any time soon, so they will continue to be available.

    Craig> (One other note -- the expression language itself will become part of JSP
    Craig> 1.3, so you'll be able to use it in template text as well as in custom tag
    Craig> attribute values.)

It would seem reasonable to consider doing what the JSTL implementors did,
which is creating two sets of tag libraries, one using the EL, and one using
scriptlets.  As it's logical to assume that the default for the JSTL is the EL,
and not RT, for each TLD, they created a "-rt" version and a non-rt version,
which assumes the EL.  In the case of Struts, you would probably want the
"default" to be the RT library, and for the "-el" library to be optional.  By
making both of these available at the same time, it allows people to fully
experiment with both alternatives.  This would only be worthwhile during the
transition.  Later releases wouldn't need this.

-- 
===================================================================
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: anyone care to clarify difference between struts and JSTL?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 2 Apr 2002, Stephenson Tim wrote:

> Date: Tue, 2 Apr 2002 17:52:46 +1000
> From: Stephenson Tim <Ti...@iie.qld.gov.au>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: "Struts mailing list (E-mail)" <st...@jakarta.apache.org>
> Subject: anyone care to clarify difference between struts and JSTL?
>
> hi all,
>
> i have taken a stroll through the mail archive and not found any clear
> definition of what is the difference between the struts taglibs and the
> 'standard' taglibs.
>
> let me admit first that i am completely new to JSTL, what i really want to
> know is should i keep going with struts tags (which i find very powerful) or
> is everyone about to switch directions?
>
> it seems to me that some tags are overlaps such as the logic tags with what
> appears to be called 'core' condition tags.
>
> and some others have been deliberately (and i believe wisely) excluded on
> grounds on breaking MVC (eg JSTL sql tags)
>
> i would be interested in your views especially in whether you guys see a
> future amalgamation of some or any of the struts tags into JSTL.
>

JSTL, as it's name implies, is (or will be when it goes final in June) the
"standard tag library" that will be portable across *all* servlet/JSP
containers once it is implemented.  This has a couple of advantages:

* Page developers will only need to learn one set of tags for the basic
  stuff like iterations and conditionals, which will work across all
  containers and across all application frameworks.

* Tool developers can afford to spend the time to make their tools aware
  of the standard tags -- it's not economically feasible to provide really
  high quality support for twenty million different taglibs.

* Container developers can design their page compilers to create optimized
  code for the standard version of the tags (such as turning <c:forEach>
  into a real Java "for" statement), for better performance.

As you noted, there is a lot of functional overlap with the Struts tags in
the "bean" and "logic" taglibs.  That's because, since Struts was around
first, it set a pretty high baseline for what people expected a standard
tag library to include.  In fact, the expert group that built JSTL took a
lot of the good ideas directly from the Struts tag libraries, as well as
from several others, and coalesced them (while improving on them at the
same time).

My advice to Struts users is as follows:

* If you're running on a Servlet 2.2 / JSP 1.1 container, you
  will not be able to use JSTL (it requires Servlet 2.3 / JSP 1.2).
  Go ahead and continue using the Struts tag libraries.

* If you're running on a Servlet 2.3 / JSP 1.2 container, you
  should begin experimenting with JSTL.  There is no problem in
  using both JSTL and Struts tags in the same page (although,
  obviously, the expression syntax is different).

* Over time, I plan to add a few features to the Struts tags to
  ease migration to JSTL for the "bean" and "logic" libraries --
  for example, I want to support the same expression language, and
  attribute names where that is possible.

* Longer term, I suggest that page developers plan on using the JSTL
  tags in their applications, as quickly as it is feasible for you
  to do so.  But we're not going to throw away the existing Struts
  tags any time soon, so they will continue to be available.

(One other note -- the expression language itself will become part of JSP
1.3, so you'll be able to use it in template text as well as in custom tag
attribute values.)

The same basic story will be my recommendation with regards to JavaServer
Faces, although that will take longer because Faces is not as far as long.
Ultimately, we want to take maximum possible leverage on the features of
JSTL and JavaServer Faces because there will be lots more tools support
for the standard libraries than the Struts libraries could ever gather by
themselves.

Of course, none of this affects your form beans, actions, and the business
logic that they call.  Aren't you glad that you followed the recommended
design patterns and split the presentation logic from the business logic?

:-)

> rgds,tim
>

Craig


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