When you start the expression with "<%=", you are
asking to print the result of the expression enclosed.
But "<%!" is used to declare member variables.
When you write a jsp, the web container converts it in
a java source class (.java) and then is compiled to a
.class .
All the "<%= expression %>" statements are replaced
with "out.print(expression)". But the "<%! expresion
%>" is copied directly in the body of the class, as
member variable for example.
Finally, if you use "<% expresion %>", the expression
is copied directly in the main method body, generally
called doService(HTTPRequest, HTTPResponse).
If you are using Tomcat, check out the
$CATALINA_HOME/work directory, here you can find the
generated classes, and look at the generated code.