Expression Tag
Since most of the times we print dynamic data in JSP page using out.print() method, there is a shortcut to do this through JSP Expressions.
Syntax:
<%= "Expression" %>
Take care that anything between <%= %> is sent as parameter to out.print() method. Also see that scriptlets can contain multiple java statements and always ends with semicolon ; but expression doesn't end with semicolon.
A JSP expression element contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. Because the value of an expression is converted to a String, one can use an expression within a line of text, whether or not it is tagged with HTML, in a JSP file.
The expression element can contain any expression that is valid according to the Java Language Specification but semicolon cannot be used to end an expression.
Following code snippet tells the working of expression tag: