• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts logic:xxx tags vs JSTL

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
alan do
Ranch Hand
Posts: 354
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Junilu Lacar
Bartender
Pie
Posts: 6548
22
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic