Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL, JSTL, Custom tags

 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know using is really bad. In my project we have used scriplets everywhere. Can i get some links which clearly talks about the disadvantages of using scriptlets and advantages of using EL, Custom TAgs, JSTL and Standard actions.
Please provide pointers.
Thanks
Deepak
[ August 19, 2008: Message edited by: Deepak Jain ]
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you searched the net with Google or any other search engine for such links?
 
sajan goel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well the main purpose and advantage in using EL,custom tags etc...is to provide easier way for web page designers. Designers need not know logic programming so we(programmers) have to provide them a lighter way by absorbing the pain of programming. And as a result EL ,custom tags, standard actions evolved...

if you are the programmer as well as designer....then obviously you love scripting...but when it comes to maintenance/re usability script-lets becomes big trouble. Pages with script-lets are hard to read & its tough for others to use your code.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pages with script-lets are hard to read & its tough for others to use your code.
Not necessarily; compare:with the equivalent in EL/JSTL:Anyone familiar with PHP or JavaScript will be fairly familiar with the scriptlet syntax (though the API details are obviously Java-specific), while the actions are totally unfamiliar and will likely just confuse them.

The main problem arising from my code above is that arbitrary Java methods cannot be invoked by EL, so we have a problem at the ???. You'd need to either put that in a front controller, a scriptlet which injects the Locales into scoped attributes, or use a custom tag, which makes it more complicated already.

There are also performance overheads to consider. Invoking the methods of custom tags has a larger overhead than code inserted directly into the scriptlet and then optimised further by the standard Java compiler. Although typically small overheads, they can add up on a very busy system.

So I think you need to use both wisely - if the code you produce is equally readable in either syntax, think about which is going to be the most straightforward for you. Always separate logic from presentation, but where presentational logic is concerned, both approaches offer their own benefits.
[ August 14, 2008: Message edited by: Charles Lyons ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Charles Lyons:
Not necessarily; compare:
Couldn't disagree more. I find the JSTL much clearer and easier to inspect.

And, if it's not easy to do something with JSTL/EL, it's either a red flag that something's being done that shouldn't be, or it's something that's easy to set up using the custom mechanisms defined by JSP 2.0.

At this stage, it is my opinion that scriptlets should be considered deprecated.
[ August 14, 2008: Message edited by: Bear Bibeault ]
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have to agree with Bear. Scriptlets should be avoided at all costs. JSTL and the EL are much easier to work with.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic