Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
  • 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.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

579 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