Forums Register Login
scriptlets Vs EL/JSTL
Hello here,
I have scjp and currently preparing for scwcd.
In the course of my preparation, i discover that all that you can do with scriplets you can also do with El and JSTL and the author is trying to paint the picture that EL and JSTL in more powerful, convinent and of more performance relaible that scriplets, now my question is, can any any one give me more than ENOUGH REASON TO CHANGE FROM WRITING SCRIPLETS IN MY JSP AND MIGRATE TO EL AND JSTL.

On the althernative, is sun trying to face out scriptlets in JSPs?

Juwonlo Ibigbami
The reasons to ditch scriptlets in favor of JSTL/EL has nothing to do with power, or performance. Rather,, in modern best practices, JSPs should not be units of processing, but units of view. They should be pure templates for the markup to be sent to the browser. As such, the design (and yes, limitations) of the JSTL and EL help to ensure that stuff that doesn't belong on a JSP doesn't get put onto a JSP.

This makes the JSPs much easier to create, maintain and extend.


1. JSTL and EL were introduced to "Replace" all the scriptlet needs in your JSP's. That's because JSP are meant to be "View related" as mentioned by Bear Bibeault, They provide the elegant and simple way of declaring what you want with all the Java code at the background.
One of the important reasons is that the "View" Aspects in any major projects are handled by "Designers" who may not be "Programmers" and hence, they are much more comfortable to "Read" or "create" JSP views using "Tags" rather than "Code".

2. Easy to Read, Maintain and Create JSP's with JSTL and EL.

3. Code Reusability. The tags are reusable but not the scriptlets which you create... unless you copy paste them
[ November 19, 2008: Message edited by: srikanth nutigattu ]

This thread has been viewed 4056 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 20, 2018 18:13:34.