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 - 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
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - CoreDzmitry Naskou
 
Java Multithreading Using Executors Framework
Java Multithreading Using Executors FrameworkJava Multithreading Using Executors Framework
Java Multithreading Using Executors FrameworkArun Mehra
 
Javascript alert and confrim box
Javascript alert and confrim boxJavascript alert and confrim box
Javascript alert and confrim boxJesus Obenita Jr.
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
 
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...Edureka!
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and DjangoMichael Pirnat
 
Web technologies lesson 1
Web technologies   lesson 1Web technologies   lesson 1
Web technologies lesson 1nhepner
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentationritika1
 
Servlet vs Reactive Stacks in 5 Use Cases
Servlet vs Reactive Stacks in 5 Use CasesServlet vs Reactive Stacks in 5 Use Cases
Servlet vs Reactive Stacks in 5 Use CasesVMware Tanzu
 
Hibernate
HibernateHibernate
HibernateAjay K
 
How to fake a database/backend in Axure... and more
How to fake a database/backend in Axure... and moreHow to fake a database/backend in Axure... and more
How to fake a database/backend in Axure... and moreSandra González
 

What's hot (20)

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
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Jaxb
JaxbJaxb
Jaxb
 
Core java
Core javaCore java
Core java
 
Java Multithreading Using Executors Framework
Java Multithreading Using Executors FrameworkJava Multithreading Using Executors Framework
Java Multithreading Using Executors Framework
 
Javascript alert and confrim box
Javascript alert and confrim boxJavascript alert and confrim box
Javascript alert and confrim box
 
Spring jdbc
Spring jdbcSpring jdbc
Spring jdbc
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
Bs Typography
Bs TypographyBs Typography
Bs Typography
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Web technologies lesson 1
Web technologies   lesson 1Web technologies   lesson 1
Web technologies lesson 1
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
 
Servlet vs Reactive Stacks in 5 Use Cases
Servlet vs Reactive Stacks in 5 Use CasesServlet vs Reactive Stacks in 5 Use Cases
Servlet vs Reactive Stacks in 5 Use Cases
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
Hibernate
HibernateHibernate
Hibernate
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
How to fake a database/backend in Axure... and more
How to fake a database/backend in Axure... and moreHow to fake a database/backend in Axure... and more
How to fake a database/backend in Axure... and more
 

Viewers also liked

Jsp (java server page)
Jsp (java server page)Jsp (java server page)
Jsp (java server page)Chitrank Dixit
 
Session 5 Tp5
Session 5 Tp5Session 5 Tp5
Session 5 Tp5phanleson
 
Enterprise Java Beans 3 - Business Logic
Enterprise Java Beans 3 - Business LogicEnterprise Java Beans 3 - Business Logic
Enterprise Java Beans 3 - Business LogicEmprovise
 
JSP Scope variable And Data Sharing
JSP Scope variable And Data SharingJSP Scope variable And Data Sharing
JSP Scope variable And Data Sharingvikram singh
 
Entity beans in java
Entity beans in javaEntity beans in java
Entity beans in javaAcp Jamod
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architectureSuman Behara
 
Error handling and debugging in vb
Error handling and debugging in vbError handling and debugging in vb
Error handling and debugging in vbSalim M
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in JavaPrasad Sawant
 
Java Web 5 - JSP, Expression Language e Taglibs
Java Web 5 - JSP, Expression Language e TaglibsJava Web 5 - JSP, Expression Language e Taglibs
Java Web 5 - JSP, Expression Language e TaglibsEduardo Mendes
 

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
 
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
 
Java Web 5 - JSP, Expression Language e Taglibs
Java Web 5 - JSP, Expression Language e TaglibsJava Web 5 - JSP, Expression Language e Taglibs
Java Web 5 - JSP, Expression Language e Taglibs
 

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}