jQuery in Action, 2nd edition*
The moose likes Struts and the fly likes Struts logic:xxx tags vs JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts logic:xxx tags vs JSTL" Watch "Struts logic:xxx tags vs JSTL" New topic
Author

Struts logic:xxx tags vs JSTL

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
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.


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

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.


Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts logic:xxx tags vs JSTL
 
Similar Threads
Struts tags or JSTL tags
Just using Struts tags
JSP:tags and Struts.
Struts and EL?
JSTL vs. Struts taglib