Expressions in JSP
by, 07-07-2012 at 08:09 PM (1358 Views)
The expression elements are supported by the JSP Page which:
• Are based on scripting language
• These expressions are evaluated.
• These expressions are coverted to a String format
• These are replaced with the expression elements in the JSP Page.
The expression elements in a JSP page are finally converted to a string so you can use it anywhere in your JSP Page. These expression elements must be valid and follow the Java Language. There is only one restriction that you can terminate a line with seimicolon as we usually do in a Java statement.
Following is an example of your JSP Expression Element:
Also you can write the above expression element in following XML supported format:Java Code:<%= your expression %>
The below code represents and example of JSP Expression.Java Code:<jsp:expression> Your expression </jsp:expression>
Java Code:<html> <body> Date: <%= (new java.util.Date()).toLocaleString()%> </body> </html>