SlideShare a Scribd company logo
1 of 29
The Unified Expression Language  Svetlin Nakov Borislava Spasova
Contents ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What is   Unified EL? ,[object Object],[object Object],[object Object],[object Object],[object Object],${some Bean .someProperty}
History of   the EL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
JSP and JavaBeans Using JavaBeans in a JSP Page
<jsp:useBean> ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<jsp:useBean id=&quot;name&quot; class=&quot;package.class&quot; scope=&quot;page | request | session | application&quot; />
<jsp:useBean>  and Scope ,[object Object],[object Object],[object Object],[object Object],[object Object]
<jsp:useBean>  – Example ,[object Object],[object Object],<jsp:useBean id=&quot;user&quot; class=&quot;beans.User&quot; scope=&quot;session&quot; /> beans. User   user  = (beans. User )   session.getAttribute(&quot; user &quot;); if ( user  == null)   { user  =  new  beans. User (); session.setAttribute(&quot; user &quot;,  user ); }
<jsp:setProperty> ,[object Object],[object Object],[object Object],<jsp:setProperty name=&quot;user&quot; property=&quot;firstName&quot; value=&quot;Nakov&quot; /> <jsp:useBean id=&quot;user&quot; class=&quot;beans.User&quot; scope=&quot;page&quot; /> <jsp:setProperty name=&quot;user&quot; property=&quot;firstName&quot; value=&quot;Nakov&quot; /> </jsp:useBean>
<jsp:getProperty> ,[object Object],[object Object],[object Object],[object Object],<jsp:useBean id=&quot;user&quot; ... /> ... User  login : <jsp:getProperty name=&quot;user&quot;   property=&quot; login &quot; /> User home page: <jsp:getProperty name=&quot;user&quot;   property=&quot;home P age&quot; />
The Unified Expression Language
Why Do We Need EL? ,[object Object],[object Object],[object Object],[object Object],<jsp:useBean id=&quot;some Bean &quot; class =&quot;somePackage.someClass &quot; scope=&quot;request, session, or application&quot;/> ${some Bean .someProperty} <jsp:getProperty name=&quot;some Bean &quot; property=&quot;someProperty&quot;/>
EL and JavaBeans – Example <% String name = &quot;Svetlin Nakov&quot;; pageContext.setAttribute(&quot;name&quot;, name); %> Name: ${name} <br /> <% User user = new User( &quot;snakov&quot;, &quot;Svetlin&quot;, &quot;Nakov&quot;); pageContext.setAttribute(&quot;user&quot;, user); %> User first name: ${user.firstName} <br /> User last name: ${user['lastName']} <br /> User login: ${user[&quot;login&quot;]} <br />
Advantages of the  EL ,[object Object],[object Object],[object Object],[object Object],${saleItem} ${collectionObject[indexOrKey]}
Advantages of the  EL (2) ,[object Object],[object Object],[object Object],${company.companyName} ${company.president.firstName}
Advantages of the  EL (3) ,[object Object],[object Object],[object Object],${param[&quot;username&quot;]} ${cookie[&quot;dateOfLastVisit&quot;]} ${ ( 2 + 5 ) * 3 } ${visitors. t otal C ount - 1} ${empty userBean}    true / false ${empty userBean ? &quot;N/A&quot; : &quot;user found&quot;}
Advantages of the  EL (4) ,[object Object],[object Object],[object Object],[object Object],[object Object]
How  Scoped Variables  Are Accessed? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],${someBean}
How  Bean Properties  Are Accessed? ,[object Object],[object Object],[object Object],${customer.firstName} <%@ page import=&quot;beans.Customer&quot; %> <% Customer customer = (Customer) pageContext.findAttribute(&quot;customer&quot;);   %> <%= customer.getFirstName() %>
How  Collections  Are Accessed? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],${someCollection[entryName]} ${someCollection . entryName}
Referencing Implicit  O bjects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
EL  Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Conditional Evaluation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],${condition ? expression1 : expression2}
Unified Expression Language in JSP and JSF
Types of Expressions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Immediate and Deferred Evaluation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],${user.firstName} # {user.firstName}
The Unified Expression Language (Unified EL) ,[object Object]
Problems ,[object Object],[object Object],[object Object]
Homework ,[object Object],[object Object]

More Related Content

What's hot

Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introductionJonathan Holloway
 
Spring Security
Spring SecuritySpring Security
Spring SecurityBoy Tech
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Hitesh-Java
 
Présentation de JEE et de son écosysteme
Présentation de JEE et de son écosystemePrésentation de JEE et de son écosysteme
Présentation de JEE et de son écosystemeStéphane Traumat
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To DjangoJay Graves
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesecosio GmbH
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoKnoldus Inc.
 
Spring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaSpring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaEdureka!
 
Security in laravel
Security in laravelSecurity in laravel
Security in laravelSayed Ahmed
 
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesSpring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesHitesh-Java
 

What's hot (20)

Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
jQuery
jQueryjQuery
jQuery
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans
 
django
djangodjango
django
 
Html JavaScript and CSS
Html JavaScript and CSSHtml JavaScript and CSS
Html JavaScript and CSS
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Présentation de JEE et de son écosysteme
Présentation de JEE et de son écosystemePrésentation de JEE et de son écosysteme
Présentation de JEE et de son écosysteme
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To Django
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
 
Spring Core
Spring CoreSpring Core
Spring Core
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Spring boot
Spring bootSpring boot
Spring boot
 
Xke spring boot
Xke spring bootXke spring boot
Xke spring boot
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Spring Boot Interview Questions | Edureka
Spring Boot Interview Questions | EdurekaSpring Boot Interview Questions | Edureka
Spring Boot Interview Questions | Edureka
 
Security in laravel
Security in laravelSecurity in laravel
Security in laravel
 
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesSpring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
 

Viewers also liked

Viewers also liked (20)

Jsp (java server page)
Jsp (java server page)Jsp (java server page)
Jsp (java server page)
 
JSP
JSPJSP
JSP
 
Jsp chapter 1
Jsp chapter 1Jsp chapter 1
Jsp chapter 1
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Session 5 Tp5
Session 5 Tp5Session 5 Tp5
Session 5 Tp5
 
Ejb3 Presentation
Ejb3 PresentationEjb3 Presentation
Ejb3 Presentation
 
Jsp
JspJsp
Jsp
 
Enterprise Java Beans 3 - Business Logic
Enterprise Java Beans 3 - Business LogicEnterprise Java Beans 3 - Business Logic
Enterprise Java Beans 3 - Business Logic
 
JSP Error handling
JSP Error handlingJSP Error handling
JSP Error handling
 
JSP Scope variable And Data Sharing
JSP Scope variable And Data SharingJSP Scope variable And Data Sharing
JSP Scope variable And Data Sharing
 
Java bean
Java beanJava bean
Java bean
 
Entity beans in java
Entity beans in javaEntity beans in java
Entity beans in java
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
EJB3 Basics
EJB3 BasicsEJB3 Basics
EJB3 Basics
 
Jsp
JspJsp
Jsp
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architecture
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
 
Error handling and debugging in vb
Error handling and debugging in vbError handling and debugging in vb
Error handling and debugging in vb
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
 

Similar to Unified Expression Language

Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...WebStackAcademy
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7phuphax
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7phuphax
 
What is Advance Java J2EE
What is Advance Java J2EEWhat is Advance Java J2EE
What is Advance Java J2EEjavaease
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesJohn Brunswick
 
Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)
Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)
Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)JavaEE Trainers
 
Ajax Applications with RichFaces and JSF 2
Ajax Applications with RichFaces and JSF 2Ajax Applications with RichFaces and JSF 2
Ajax Applications with RichFaces and JSF 2Max Katz
 
Java Server Faces 1.2 presented (2007)
Java Server Faces 1.2 presented (2007)Java Server Faces 1.2 presented (2007)
Java Server Faces 1.2 presented (2007)Peter Antman
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2Jim Driscoll
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpointwebhostingguy
 

Similar to Unified Expression Language (20)

Jsp
JspJsp
Jsp
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
 
Os Leonard
Os LeonardOs Leonard
Os Leonard
 
JavaEE Spring Seam
JavaEE Spring SeamJavaEE Spring Seam
JavaEE Spring Seam
 
What is Advance Java J2EE
What is Advance Java J2EEWhat is Advance Java J2EE
What is Advance Java J2EE
 
C:\fakepath\jsp01
C:\fakepath\jsp01C:\fakepath\jsp01
C:\fakepath\jsp01
 
I Feel Pretty
I Feel PrettyI Feel Pretty
I Feel Pretty
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server Pages
 
Jsf Ajax
Jsf AjaxJsf Ajax
Jsf Ajax
 
Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)
Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)
Servlet/JSP course chapter 2: Introduction to JavaServer Pages (JSP)
 
Learning jsp
Learning jspLearning jsp
Learning jsp
 
Ajax Applications with RichFaces and JSF 2
Ajax Applications with RichFaces and JSF 2Ajax Applications with RichFaces and JSF 2
Ajax Applications with RichFaces and JSF 2
 
Java Server Faces 1.2 presented (2007)
Java Server Faces 1.2 presented (2007)Java Server Faces 1.2 presented (2007)
Java Server Faces 1.2 presented (2007)
 
Jsp 01
Jsp 01Jsp 01
Jsp 01
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpoint
 

More from BG Java EE Course (20)

Rich faces
Rich facesRich faces
Rich faces
 
JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
 
JSTL
JSTLJSTL
JSTL
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
CSS
CSSCSS
CSS
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
WWW and HTTP
WWW and HTTPWWW and HTTP
WWW and HTTP
 
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
 
Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSS
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Data Access with JDBC
Data Access with JDBCData Access with JDBC
Data Access with JDBC
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Introduction to-RDBMS-systems
Introduction to-RDBMS-systemsIntroduction to-RDBMS-systems
Introduction to-RDBMS-systems
 
Basic data-structures-v.1.1
Basic data-structures-v.1.1Basic data-structures-v.1.1
Basic data-structures-v.1.1
 
Basic input-output-v.1.1
Basic input-output-v.1.1Basic input-output-v.1.1
Basic input-output-v.1.1
 

Unified Expression Language

  • 1. The Unified Expression Language Svetlin Nakov Borislava Spasova
  • 2.
  • 3.
  • 4.
  • 5. JSP and JavaBeans Using JavaBeans in a JSP Page
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 12.
  • 13. EL and JavaBeans – Example <% String name = &quot;Svetlin Nakov&quot;; pageContext.setAttribute(&quot;name&quot;, name); %> Name: ${name} <br /> <% User user = new User( &quot;snakov&quot;, &quot;Svetlin&quot;, &quot;Nakov&quot;); pageContext.setAttribute(&quot;user&quot;, user); %> User first name: ${user.firstName} <br /> User last name: ${user['lastName']} <br /> User login: ${user[&quot;login&quot;]} <br />
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. Unified Expression Language in JSP and JSF
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.

Editor's Notes

  1. SPEL – Simplest Possible EL SEL – Simple EL JSP EL не е подходящ - I mmediate evaluation , read-only Влиза в JSP - JSP EL или SEL (JSP 2.0) JSP&apos;s EL made retrieving values and resolving variables easier. Rather than using &lt;jsp:useBean&gt; and &lt;jsp:getProperty&gt;, a developer could simply use ${bean.property}