• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts logic:xxx tags vs JSTL

 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a long-time struts user, and am quite comfortable with struts tags, but as I see the continuing trend toward JSTL and EL becoming more and more an integral part of JSP, I've recently decided that in future development I'm going to use JSTL tags for controlling logic flow in JSPs rather than the struts logic:xxx tags. I noticed that Alan Do posted recently that he is doing the same. I'd be interested in hearing the opinion of others out there regarding which of these tags you're using and planning to use.

Naturally, I'll still be using the html:xxx tags, as there is nothing comparable in JSTL. I'm also planning on starting to test out the struts-el versions of the tag libraries to see how well they work.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made the switch not too incredibly long ago.

One thing I like about JSTL is the ability of if/else blocks using c:choose / c:when / c therwise.

On the down side, the variables in JSTL are not saved as regular instance variables which can get frustrating. If you use the struts-el tags it makes the communication between JSTL and struts tags a little easier.
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i switched over to JSTL nearly 2 years ago never looked back. anything i could do with struts-logic and struts-bean tags i can do with the core and format libraries (and much more effiently, especially EL automatic type conversion/coercion). complex conditional statements are handled wonderfully in JSTL (as marc said). one quirk with JSTL is the 'empty' comparator on Collections (it works for some, not all Collections).

please do let us know your results between struts-EL vs. JSTL tags.
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Struts folks themselves encourage the use of JSTL in favor of the Struts-specific tags when appropriate. I pushed for the use of JSTL over logic tags and scriplets on my last project and plan to continue to encourage its use in the future (until something better comes along, of course )

I have experienced the inconvenience that Marc pointed out about JSTL variables not being readily available as instance variables but that can be easily remedied by using EL-enable tags. You can also resort to accessing the values from the page context.
reply
    Bookmark Topic Watch Topic
  • New Topic