Expressions in JSP

How are Expressions used in JSP?

Explanation

JSP Expressions are an easy method to include data into a HTML page. JSP Expression does not need a out.println() to display the result. JSP Expression is specified between the tags "<%=" and "%>".

Syntax:


<%= expression %>

Example :


<%="An example for JSP Expression:: "+ (3+3) %>
Result :

An example for JSP Expression:: 6

In the above example we can see that the output of the expression is displayed in the HTML page directly.But when strings are concatenated usin the JSP expression the precedence rule gets into act.

Ask Questions

Ask Question