• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL and declaratives  RSS feed

 
shaf maff
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?
 
Vijitha Kumara
Bartender
Posts: 4002
42
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.
 
Bauke Scholtz
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: 4002
42
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!