How to use Expression in JSP

Example :exp1.jsp

<html>

<head>

<title>JSP Expression Page</title>

</head>

<body>

<h2>JSP Expression Page</h2>

<p> <%= 3+3 %><br>

<%= 2*3 %><br>

<%= (2*3) + (3+3) %><br>

<%= “Here is some text ” + (2*3) + (3+3) %><br>

<%= “Here is some text ” + ((2*3) + (3+3)) %><br>

<%! String aString = “What is two times 3? “; %>

<%! int x = 2; %>

<%! int y = 3; %>

<%= aString + (x*y) %>

</p>

</body>

Leave a Reply

Your email address will not be published. Required fields are marked *