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.

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.
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline


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:

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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countPairs challenge 7 58
strCount chalenge 3 50
topping3 challenge 14 51
maven example error 3 36
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now