Skip to main content

Expression tag in JSP

JSP provide

1.Scriptlet tag
2.Expression tag
3.Declaration tag

Expression tag


Using Expression tag you can print the statement, variable data and output of method without using out.println()

syntax:

1
2
 
<%= Statement %>

Example of Expression tag


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
<%@ page language="java" contentType="text/html; %>
 
<%@ page import="java.util.Date"  %>    
 
<html>
<head>
<title>Insert title here</title>
</head>
<body>
 
<h1>
 
Today's Date: <%= new Date() %>
 
</h1>
 
 
</body>
</html>

Output:
date