wood burning stoves 2.0*
The moose likes Struts and the fly likes JSTL vs. Struts taglib Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSTL vs. Struts taglib" Watch "JSTL vs. Struts taglib" New topic
Author

JSTL vs. Struts taglib

Ali Ekber
Ranch Hand

Joined: Jun 12, 2005
Posts: 41
Can someone give a brief reasoning why we would one over another? I know there is a forEach in JSLT and logic:iterate in Struts which are compariable, but when to use one over another. Thanks.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I personally prefer to use JSTL whenever the same function can be performed by either a Struts tag or a JSTL tag. My reasons for doing this are:

  • JSTL tags are more standard. Any Java EE developer worth their salt knows these tags, but Struts tags are not part of the standard.
  • JSTL tags are more powerful. For example, it's easy to do and/or logic in JSTL tags, but not in Struts tags.


  • I do make heavy use of the <html:xxx> tags, though, as there is no equivalent of these in JSTL.


    Merrill
    Consultant, Sima Solutions
    Brent Sterling
    Ranch Hand

    Joined: Feb 08, 2006
    Posts: 948
    I have to admit that I use the logic tags more that I probably should. Mostly because that is what I started with when I got into Struts development. I don't do much JSP development these days and I guess nobody on the team has stepped up to say that we need to use JSTL more.

    I am curious. Are there logic tags that do not have equivalent JSTL tags or are there logic tags that are more convenient to use? Could we abandon the logic tags? If we use JSTL heavily, should we also be using struts-el? (sorry, not trying to hijack your thread)

    - Brent
    Merrill Higginson
    Ranch Hand

    Joined: Feb 15, 2005
    Posts: 4864
    About the only <logic:xxx> tags I use are <logic:messagesPresent> and <logic:messagesNotPresent> since these deal with Struts-specific messages, and there is no equivalent in JSTL. For all the others, JSTL is eaiser to use and more powerful

    The same is mostly true of the <bean:xxx> tags, whith one notable exception: There is no equivalent to the <bean:size> tag, and that one comes in handy.

    Regarding the struts-el tags: Since the web tool I'm using handles regular struts tags better than struts-el tags, I tend to use the regular ones more. However, when I need to use a run-time expression in a Struts tag, I'll use struts-el.

    The trend is toward "scriptless JSPs", and while I'm not fanatical about it, I try to keep scriptlets out of my JSPs as much as possible, and one way to do that is to use struts-el.
    Merrill Higginson
    Ranch Hand

    Joined: Feb 15, 2005
    Posts: 4864
    I don't believe there is anything comparable to the nested tags in JSTL. As I see it, the only reason for using them is if you're using indexed properties and want Struts to handle the naming of indexed properties for you. I don't generally use the nested tags, as I prefer to handle the naming of indexed properties myself.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: JSTL vs. Struts taglib
     
    Similar Threads
    Should I even bother learning JSF?
    Whats happening to the market ?
    Struts
    STRUTS: WHY???
    Injecting Simple properties ? Guice or Spring