0%
JSTL and EL

JSTL and EL

The tools that make scriptlets permanently obsolete.

15-20 min

JSTL and EL

The lesson on JSPs laid down a prohibition — no <% %> tags — without yet providing the means to follow it. Without a Java loop, how do you display thirty products? Without a Java conditional, how do you hide a button reserved for administrators? Without a method call, how do you format a price in euros or a date in French?

The answer lies in two complementary technologies. The Expression Language (EL) provides a compact syntax for reading data: ${produit.nom} where a scriptlet would write seven words. JSTL (Jakarta Standard Tag Library) provides tags for control structures: looping, testing, formatting, without ever writing Java.

There is an installation trap that costs almost everyone who discovers Jakarta EE 10 an evening, and this lesson starts with it. JSTL is not provided by Tomcat: it is a dependency you have to add. The Maven coordinates and the taglib URIs have all changed with the move to Jakarta. Online documentation, overwhelmingly, still gives the old ones, and the symptom of a wrong combination is particularly discouraging: the page renders with your <c:forEach> tags visible as plain text in the HTML, or refuses to compile with a message about an absolute URI that cannot be resolved.

Comments

Comments are powered by GitHub Discussions

Sign in with GitHub to join the discussion

Link copied!