• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

scriptlet VS Tag in JSP

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Would like to know if a scriptlet or tag in JSP would be faster interms of performance.
Any idea is appreciated

krishna
SCJP1.4
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The difference is trivial.
I'd be more concerned with clarity and maintainability.

If a tag means pulling out non-view stuff that a web designer could break, then it would be well worth the microseconds lost (if there are any).
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only real difference is in the time it needs to compile.
Scriptlets are added to the generated Java source verbatim, while tags need to be parsed to generate the method calls (and potentially object instantiations) they represent.
At runtime the difference is probably trivial.

The only real difference is that using scriptlets you're able to get more code into your JSP as tags will typically result in more and longer method calls.
But if your JSP is getting so large that switching from scriptlet code to tags brings you over the maximum size for methods the JVM will accept (64KB compiled code per method) you have more serious problems and should really split up the JSP into several distincs modules using <jsp:include> tags.
reply
    Bookmark Topic Watch Topic
  • New Topic