tags:

views:

150

answers:

3

Hi I like to know I read all the all the time use JSTL or EL in JSP.. Just curious to know does scriptlet in JSP hit the performance?

+1  A: 

First, using scriptlets (embedding raw Java code in JSP using the old fashioned <% %> things) is not the same as using taglibs (e.g. JSTL) and EL (the ${} things).

The performance penalty of taglibs and EL is really negligible and only noticeable during compilation and does by far not outweigh the advantages of using taglibs and EL instead of scriptlets.

BalusC
I suspect you completely misunderstood the question. It sounds like he understands perfectly what scriptlets are and just wonders whether the advice against using them and using JSTL and EL is because the latter are *better* for performance...
Michael Borgwardt
It *sounds like*, yes ;) Just let's see what the OP says instead of throwing with heavy words :)
BalusC
A: 

All JSP taglibs and scriptlets get compiled to a Java class before execution, so there's virtually no performance difference for using one or the other.

Kaleb Brasee
not exactly true - using scriptlets will probably lead to a slightly shorter call chain than using tags, since scriptlet is basically java source that gets compiled into your jsp, while tags goes thru another layer of indirection. tho negligible, if it can even be observed in practice.
Chii
+2  A: 

The general advice to use JSTL and EL instead of scriptlets has absolutely nothing to do with performance; if anything, scriptlets are likely to yield better performance.

But they also lead to "tag soup" that is hard to maintain. You're supposed to use JSTL/EL because JSPs are supposed to be a presentation layer and not contain significant logic.

Michael Borgwardt