Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Link to posts criticizing JSP Taglibs as scriptlets in disguise

Posted on 2004-08-15
Last Modified: 2013-11-24
I am looking for an article or post I am sure I saw (or maybe it is in a book and someone can recall which one) where some taglibs, such as the JSTL "c" namespace tags, are criticized as scriptlets in disguise, because they still just offer the same control functionality as the java language rather than really representing some presentation semantic.

I am currently working in a small company and a new team-member is strongly suggesting we all move away from scriptlets to tags.  While to some degree this notion has merit, we do not really have a situation in which there are non-programmers doing JSPs, nor do we have significant trouble maintaining a clear separation of logic from presentation in most cases.  Additionally, some members of the team have claimed to experience performance issues significant enough to abandon the use of tag libraries in the past.

We haven't the time to do extensive prooof-of-concept work, nor are we certain we could cover enough scenarios, to establish the pros/cons adequately enough to dissent or acquiesce on our own.

I'd like links to relevant articles evaluating the design and performance characteristics of taglibs, NOT to tutorials on their creation or use (that knowledge we have or know already).

Of course, experts opinions and experience with tags vs. scriptlets is also appreciated, but please...something beyond the repeating of the cliches about separation of business logic and presentation, etc.  I want real-world anectdotes and informed opinions based on experience, not quotes from the current mass media expounding the virtues of the latest technologies and design fads (patterns).

I'll split points among the most helpful posts.  THANKS!!!!

Question by:sbockelman
  • 3
  • 2
  • 2
  • +1

Expert Comment

ID: 11806897
LVL 92

Expert Comment

ID: 11807240
Is performance the only objection to using tag libraries?

Author Comment

ID: 11815595

There are numerous points being rasied as concerns the use of tag libraries vs. other technologies, such as XSLT, or just plain ol' java logic.

Performance is one particular concern coming from one particular team member who claims to have had to rip tag libs out of a page in order to get performance down from 60-70 seconds to 2-3 seconds.  This is anecdotal and unsubstantiated, of course, but... he is a senior member of the staff, so... he needs to be met with some evidence of compelling evidence to the contrary.

More so, I find that the need to learn (and read) yet-another-syntax is only worthwhile if it truly offers something we cannot already achieve using what we already know.  Not that anyone on staff finds taglibs particular complex, mind you...but it is just sort of a cognitive annoyance to have to keep getting used to new ways of saying the same things.

Finally, I am sure I saw a very eloquent post, or article, or maybe an excerpt from a book, that criticized some taglibs in particular as being naive in that they simply replaced java logic constructs with tags (e.g., <c:if> is still just an iff condition) and advocated a more business-specific or application-specific level of functionality.  I'd like to find that article or book again.

For the first poster, Drop of Rain, I appreciate your participation, but I specifically asked for links that talk about whether to use taglibs or not... NOT tutorials or general info links.  
Thanks anyway.  Perhaps you will run accross such discussions and think back and post them here.  

Anyway...I'll keep,looking and hope to hear some helpful stories soon.

The major proponent is arguing that taglibs "enforce" separation of logic and presentation.  With tags such as forEach, if, etc.,  I just don't see it. These appear to me to just be new and more awkward ways of performing the same logic.  That is, these are just scriptlets in disguise.

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

LVL 92

Expert Comment

ID: 11815947
If your team is all Java developers then the advantages of using tags are lessened, but it still provides a standard means for reuse of code in your jsps. They can also improve the readability of your jsp.

I'd suspect the poor experience performed was due to use of poorly written tags, which can happen whether or not you use tags. You'd need a concrete example to determine the exact cause.

Sorry I haven't seen the article you refer to.

Author Comment

ID: 11934129
I don't think I can really award any points here, sorry...

I am really looking for a particular level of critique (or links to such) as pertains the use of Tag Libraries as a "best practice" for application design.

Drop of Rain posted only easily found tutorials on using Tag Libraries, which is not what I asked.

objects, though I appreciate and respect your comments (and probably have to agree that the performance problems are situational or anecdotal at best), they didn't really help me argue with my colleagues, who want to establish a "one way to do things" sort of mentality (with which I fundamentally disagree, of course).

I personally find that the use of Tag Libraries can hide some logic, especially if you aren't used to reading them or if your editor doesn't cause them to stand-out (mine doesn't, but it highlights scriptlet code).  So, to me, readability is a concern.  Performance MAY be degraded just by the nature of the mechanics of the tags, each is a separate object that must be instatiated, populated, then execute methods...inline code is usually more efficient.  Some JSP compilers may inline tags??  I haven't seen any that do, however.  And tags that use reflection to get bean properties may incur additional overhead, as well.

That said, I have actually created custom tags for some projects and enjoyed their use, but these were to do things like formatting dates, numbers, and special Strings, like phone numbers, social security numbers, etc.  I could even see how specific-to-the-solution-domain tags might be an excellent tool, but...

What our guys are doing is, to me, just scriptlets in disguise:  <c:for-each />, <c:if />, etc....
And I just don't see the benefit over <% if( ) { %>content<% } %>

I was sure I had read an article supporting my position, but I cannot find it again.  I was hoping one of you guys would have seen it, or maybe even written it, who knows?  Oh well...

back to coding...


Author Comment

ID: 11938321
I finally found an article with one section similar to the kind of information I have been seeking; see section 3 of the article at: http://www.informit.com/articles/article.asp?p=30334

Anyone know of more like this?
LVL 14

Accepted Solution

sudhakar_koundinya earned 125 total points
ID: 11939797
LVL 14

Expert Comment

ID: 11939803

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question