Wednesday, August 25, 2021

How to use Expression language in JSP - Example

In order to use Expression language in JSP you need to include JSTL 1.1 Jar. It was introduced in JSP 2.0 version. Alogn with JSTL and custom tag library, JSP expression langauge are very important to minimize Java codes from JSP pages and by using thsi we can create more maintainable JSP pages. JSP Expression language or EL allows you to access attribute and properties of any object seemlessly without using scriptlet. You can use expression language as ${expr} and its processed at runtime by JSP engine. You can disable use of expression language in any JSP page by using taglib directive. 


Syntax of Expression language


Implicit objects for Expressionlangauge


Benefits of using expression language


Expression language example in JSP


That's all about how to use expression language in JSP. 


important points about expression langauge (EL)

1) Expression language provides a mechanism for enabling the presentation layer (JSP pages) to communicate with application logic (managed beans) without using Java code or scriptlet. 

https://docs.oracle.com/javaee/6/tutorial/doc/bnahu.html

2) EL is used by both Java server pages (JSP) and JavaServer Faces (JSF).


3) EL allows JSP developers or page authors to use simple expressions to dynamically access data from any collection or object. EL greatly improves readability of JSP pages.


4) EL can also be used with Java Enum


No comments:

Post a Comment

Feel free to comment, ask questions if you have any doubt.