• Post Reply Bookmark Topic Watch Topic
  • New Topic

tags over Scriptlets  RSS feed

 
Anil Kumar Saha
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any performance improvement if we avoid using Scriptlets and prefer JSP inbuild tags, like <jsp:UseBean> ?
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My gut instinct would be that scriptlets would be faster in execution as they become inline code when the JSP gets compiled into a servlet. Tags require the overhead of object creation, initalizing context and the various tag method calls (startTag, stopTag), some of which may not be used in your particular tag use.
That said, computer time/effort is cheap and developer time/effort is expensive. There is much to be said for using tags rather than writing spaghetti code in JSP's. It is easier/less error prone to share code using tags than copying code between JSP's as well.
Remember, "Premature optimization is the root of all evil". Use the right tool for the job and worry about tweaking the code after you've done benchmarks and identified the real bottlenecks.
 
Anil Kumar Saha
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ess,
Thanks a lot for detail explanation.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!