JSP Expression Tag

JSP expression tag allows you to place the result of Java expression in a convenient way. It can be seen as an alternative of out.print() method.

Thus, if we want to print any statement or result directly then we can use the below syntax:

<%=result%>

Note: Java statement in expression tag doesn't required a semicolon to terminate.

Example of JSP Expression Tag

In this example, we are just printing a string without using out.print() method.

<html>
<head>
<title>Tutorial and Example</title>
</head>
<body>
<h1><center>
<%="Welcome to JSP tutorial" %>
</center></h1>
</body>
</html>
Output: JSP Comments JSP provides separate tag for comment section. The content inside these tag is completely ignored by JSP engine. The syntax of comment tag is mentioned below. <%-- This is a comment section --%> In JSP, a tag inside another tag is not allowed. So, comment tag cannot be used inside the scriptlet elements. Instead of JSP comment, you can also use HTML comment.