This tutorial contains description of Expressions which is one of JSP page element.
Expressions in JSPs is used to output any data on the generated page. These data are automatically converted to string and printed on the output stream. It is an instruction to the web container for executing the code with in the expression and replace it with the resultant output content. For writing expression in JSP, you can use <%= and %> tags
<%= expression %>
semicolon is not permitted within a JSP expression but for same, semicolon is
used for scriptlets. Expressions are checked at run time so it has access to all
of the JSP implicit objects.
<%@page import="java.io.PrintWriter"%><html> <head> <title>Scriptlet Example</title> </head> <body> <%!int a = 10; int b = 20;%> <% int sum = a + b; %> Sum of a= <%=a%> and b= <%=b%> is : <%=sum%> </body> </html>
Posted on: December 3, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles