JSP Expression Tag : In JSP the Expression tag is used to print in the output stream.So whenever you have some data to print into the screen or can say browser you can use the JSP Expression Tag.
The java code '<% out.println(msg); %>' can be replaced with the Expression tag <%= msg%>.
Syntax of the Expression Tag :
<%= Java Expression %>
Example of the Expression Tag : Here is the simple code to show how you can use the JSP Expression tag.
App.jsp
<html>
<head>
<title>Simple JSP Page</title>
</head>
<%
int x = 15;
int y = 20;
%>
<body>
Sum of x and y is : <%= (x+y) %>
</body
</html>
Output : Sum of x and y is : 35
As you can see in the JSP expression tag we don't need to use the semicolon (;) at the end of the expression.
0 Comment(s)