“Compound” Scriptlets
A compound statement in the generated code does not have to be limited to a single scriptlet element.
Instead can be assembled from several scriptlet elements, surrounding blocks of template text.
Here is an example using a conditional around blocks of template data (taken from the book by Hall):
<html><head></head><body>
<% if (Math.random() < 0.5) { %>
Have a nice day!
<% } else { %>
Have a lousy day!
<% } %>
</body></html>