• Post Reply Bookmark Topic Watch Topic
  • New Topic

scriptlets Vs EL/JSTL  RSS feed

 
Juwonlo Ibigbami
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks
Juwonlo Ibigbami
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ENOUGH REASON TO CHANGE FROM WRITING SCRIPLETS IN MY JSP AND MIGRATE TO EL AND JSTL.


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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!