Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JSTL and declaratives  RSS feed

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys

Why is it better to use JSTL in JSP files instead of declaratives?
 
Bartender
Posts: 4047
48
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by declaratives? JSP declarations ?
 
shaf maff
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you have java code between the <% and %> tags.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
He meant scriptlets.

Answer is simple: scriptlets are not part of presentation logic while JSP is a presentation technology. So with scriptlets you're in fact mingling business, database and/or utility logic in a JSP file, of which each essentially belongs in a Java class. With taglibs and EL you (greatly!!) improves maintainability, readability, reusability, replaceability and so on.

JSP came around 1998. After that the guys realize that it is in no way OO. Then the taglibs came around 2000, starting with JSTL. Which was a great enhancement. Taglibs allows seamlessly and pure OO interaction between the presentation logic (HTML/CSS/JS and so on) and the backend (Java) logic.
 
Vijitha Kumara
Bartender
Posts: 4047
48
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%%> are called scriptlets and <%! %> called declarations and <%= %> called expressions where all of these should be avoided in the JSPs (or at least in new pages). You can eliminate them by using JSTL end EL with the java beans.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Scriptlets", "scriptlet declarations" and "scriptlet expressions".
 
shaf maff
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!