Link to posts criticizing JSP Taglibs as scriptlets in disguise

Posted on 2004-08-15
Medium Priority
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
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
  • 3
  • 2
  • 2
  • +1
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.

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

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 375 total points
ID: 11939797

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

770 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