minyou song
minyou song

Reputation: 39

what's the difference between Scriptlet Expression and el

it was on my exam paper, and i don't know when is the proper timing to use each expression. they can calculate numbers, and put data into variables. so I couldn't catch certain difference between there.. can someone know that? let me know that.. I'm confusing :/

"<%=%>"

${}

Upvotes: 2

Views: 1553

Answers (1)

raviraja
raviraja

Reputation: 706

Both serves the same purpose in the end, i.e writing java code in JSP, but there are some caveats

  • JSTL i.e expression language ${} is introduced to separate the View from the Business Logic to adhere with MVC pattern.
  • you can reuse the JSTL code by importing libs, same is not the case with scriptlets.
  • It's hard to maintain the code that is written in scriptlets and it's not unit testable.

that's the reason

Where possible, avoid JSP scriptlets whenever tag libraries(JSTL) provide equivalent functionality.

Upvotes: 3

Related Questions