JSP Expression Language provides the facility to access the properties of java bean components or other implicit object. It is introduced in the JSP version 2.0. We can write both arithmetic and logical expressions using JSP Expression Language.
Example:
test.jsp
<html> <head> <title>expression language example</title> </head> <body> <h3>This is an expression language example.</h3> 20 is greater than 30: ${20 > 30} <br/> Sum of 20 and 30: ${20 + 30} </body> </html> |
web.xml
<web-app> <welcome-file-list> <welcome-file>test.jsp</welcome-file> </welcome-file-list> </web-app> |
Output:
Download this example.
Next Topic: JSTL (JSP Standard Tag Library) with example.
Previous Topic: Exception handling in JSP with example.