Just when you thought it was safe, Kim notices the scriptlet with an out.println() statement. This is JSP, folks. Part of the whole point of JSP is to avoid println()! That’s why there’s a JSP expression element—it automatically prints out whatever you put between the tags.
<%@ page import="foo.*" %> <html> <body> The page count is: <% out.println(Counter.getCount()); %> </body> </html>
<%@ page import="foo.*" %> <html> <body> The page count is now: <%= Counter.getCount() %> </body> </html>
The expression is shorter—we don’t need to explicitly do the print...
Notice what’s different between the tag for the scriptlet code and the tag for the expression? The scriptlet code is between angle brackets with percent signs : <% and %>. But the expression adds an additional character to the start of the element—an equals sign (=).
So far we’ve seen three different JSP element types: