Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Mixing JSTL and Scriplets

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it considered bad practice to mix JSTL and scriptlets? For instance the following code appears to work fine:



...but are there situations when this could NOT work?

Thanks,
Scotty
 
Marshal
Posts: 67415
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Scott Maclary:
Is it considered bad practice to mix JSTL and scriptlets?



Very. The whole purpose of the JSTL and EL is to supplant, not support, scriplet usage. The only caveat is if you are still using JSP 1.2 with JSTL 1.0, in which case complete elimination of scriptlets is not always feasible.

As of JSP 2.0 on the other hand, scriplets should be considered deprecated.

Scriplets can cause problems in JSP 2.0 when used in the bodies of simple tags, to include tag files.

Bottom line: either use modern JSTL and EL, or use scriptlets. Anything in between is just a mess.
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic