# How to write a JSP Expression?

JSPJava 8Object Oriented ProgrammingProgramming

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, you 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 you cannot use a semicolon to end an expression.

Following is the syntax of JSP Expression −

<%= expression %>

You can write the XML equivalent of the above syntax as follows −

<jsp:expression>
expression
</jsp:expression>

Following example shows a JSP Expression −

<html>
</html>
Today's date: 11-Sep-2010 21:24:25