SlideShare a Scribd company logo
GUJARAT TECHNOLOGICAL UNIVERSITY
Chandkheda, Ahmedabad
Affiliated
G. H. Patel College of Engineering and Technology,
VallabhVidyanagar
A
Presentation
On
Expression Language
Under subject of
ADVANCED JAVA
Semester – VI
Computer Engineering
Submitted by: Hemant Suthar(130110107058) Submitted to: Prof. Hetal Gaudani
Content
• Definition
• Methods used to call Java Code
• Benefits of EL
• Types of EL
• References
Definition
• EL is a language that allows JSP programmers to fetch application data
stored in JavaBeans component.
Methods used to call Java Code
• The following methods are used to call the java code from a JSP page:
• 1. Placing the entire Java code in a JSP page
• 2. Defining separate helper classes that encapsulate the entire Java
code and calling these helper classes from a JSP page
• 3. Using JavaBeans and JSP page action tags
• 4. Using JSP EL
• 5. Create tag handler classes to embed the Java code
Benefits of EL
• The incorporation of EL to the JSP has helped reduce the use of
scriptles in JSP page.
• EL expressions provide short hand notations to retrieve, present, and
manipulate Web application data.
Basics of EL
• EL expressions are enclosed between the ${ and} characters.
• The most general example of an EL expression is ${object.data}
• Where, object can be any Java object representing different scope,
such as request, session.
Types of EL
• EL expression tags can be categorized into the following types:
• 1. Immediate and deferred expressions
• 2. Value expressions
• 3. Method expressions
Immediate and deferred expressions
• Two constructs are used to represent EL expressions,
JSP{ expr } used for expressions that need to be evaluated
immediately, and
 #{ expr } used for expressions that need to be evaluated at later
time.
• An expression that uses ${ expr } is called immediate expression and
• The expression that uses #{ expr } is called deferred expression
Value Expressions
• Value expressions are used to refer to objects such as JavaBeans,
Collections, enumerations and implicit objects and their properties.
• An object is referred to by using the value expression containing the
name of the object
• Suppose the ${ employee } expression is used in a JSP page, where
employee refers to the name of a JavaBean
• Which searches for the employee JavaBean in the request, session
and application scopes
• If the employee JavaBean does not exist. a null value is returned.
Continue…
• Syntax of value expression to access properties and elements of a
collection in java uses two operators. ( . ) and ( [] ).
• For example.
The name property of the employee JavaBean can be referred as
${employee.name} or ${ employee[“name"] } expression.
To access a specific element of a collections such as list or an
array inside a JavaBean we can use ${ employee.name[0] }, ${
employee.name[1] }, etc...
Continue…
• The value expressions are of two types:
• rvalue
rvalue expression can only read data, and not write data.
• lvalue
lvalue expression can read as well as write data.
Method Expressions
• Method expressions are used to call public methods. which returns a
value or object.
• Such expressions are usually deferred expressions.
• Tags usually use method expressions to call functions that perform
operations such as validating a UI component or handling the events
generated on a UI component.
• The following code snippet shows the use of method expressions in
JSF page:
Continue…
<h:form>
<h:inputText
id="email"
va1ue="#{employee.email}
validator="# {employee.validateEmail} " />
<h:commandButton
id="submit"
action="#{customer.submit}" />
</h:form>
Continue…
• The various elements shown in the preceding code snippet can be
briefly described as follows:
• The inputText tag : shows the Ullnput component in the form of a text field on
a webpage.
• The validator attribute : calls the validateEmail method of the employee
JavaBean.
• The action attribute of the commandButton tag : calls the submit method,
which carries out processing after submitting the webpage.
• The submit method : Refers to the method that is called during the invoke
application phase of the JSP life cycle.
References
• http://www.darshan.ac.in/Upload/DIET/Documents/CE/Advanced%2
0Java%20technology_Unit-7_05012015_081036AM.pdf
• Advance Java Technology by M.T. Savaliya Published by Dreamtech
Press/Wiley India, 2011
Expression language

More Related Content

PPT
FUNDAMENTALS OF CAM By Using MASTERCAM
PDF
Bolígrafos importación
PDF
Core design meeting 1
PPTX
La web2 francis
PPTX
Maddie joshmontanamarsha
PPTX
Why product of two negative numbers is positive?
PDF
The Success Guide V4
PPTX
Presentation lea sj. de jesus
FUNDAMENTALS OF CAM By Using MASTERCAM
Bolígrafos importación
Core design meeting 1
La web2 francis
Maddie joshmontanamarsha
Why product of two negative numbers is positive?
The Success Guide V4
Presentation lea sj. de jesus

Viewers also liked (9)

PPTX
All process models
PDF
2009 rocks_and_minerals__the_restless_earth_
ODP
facebook
PDF
Core design meeting 1
PPS
PDF
Lluvia de ofertas
PPTX
Pancasila sebagai solusi permasalahan suatu bangsa
PPTX
ILLUMINATION & LIGHTING
PPT
Palliative care
All process models
2009 rocks_and_minerals__the_restless_earth_
facebook
Core design meeting 1
Lluvia de ofertas
Pancasila sebagai solusi permasalahan suatu bangsa
ILLUMINATION & LIGHTING
Palliative care
Ad

Similar to Expression language (20)

PPTX
Web programming-Introduction to JSP.pptx
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
PPTX
Java Server Pages
PPTX
Java Server Pages
PPTX
Complete PPT about the Java lokesh kept it
PPTX
JSP.pptx
PPTX
WTA-MODULE-4.pptx
PPTX
SCWCD : Java server pages CHAP : 9
DOC
Spatial approximate string search Doc
PPTX
Implicit Objects &Handling.pptx
PPTX
JSP AND XML USING JAVA WITH GET AND POST METHODS
PPTX
JSP Directives
PPT
Unified Expression Language
PPTX
Eclipse e4 on Java Forum Stuttgart 2010
PPTX
Final Java-script.pptx
PPTX
jsp elements java server tag with jsp elements .pptx
PDF
Iwt note(module 2)
PPTX
PPTX
JavaScript, often abbreviated as JS, is a programming language and core techn...
PPTX
Introduction to JAVA SCRIPT USING HTML and CSS
Web programming-Introduction to JSP.pptx
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
Java Server Pages
Java Server Pages
Complete PPT about the Java lokesh kept it
JSP.pptx
WTA-MODULE-4.pptx
SCWCD : Java server pages CHAP : 9
Spatial approximate string search Doc
Implicit Objects &Handling.pptx
JSP AND XML USING JAVA WITH GET AND POST METHODS
JSP Directives
Unified Expression Language
Eclipse e4 on Java Forum Stuttgart 2010
Final Java-script.pptx
jsp elements java server tag with jsp elements .pptx
Iwt note(module 2)
JavaScript, often abbreviated as JS, is a programming language and core techn...
Introduction to JAVA SCRIPT USING HTML and CSS
Ad

Recently uploaded (20)

PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Internship_Presentation_Final engineering.pptx
PPT
Project quality management in manufacturing
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
ANIMAL INTERVENTION WARNING SYSTEM (4).pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
anatomy of limbus and anterior chamber .pptx
PDF
Queuing formulas to evaluate throughputs and servers
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Road Safety tips for School Kids by a k maurya.pptx
PPTX
MET 305 MODULE 1 KTU 2019 SCHEME 25.pptx
PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
Monitoring Global Terrestrial Surface Water Height using Remote Sensing - ARS...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
web development for engineering and engineering
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Embodied AI: Ushering in the Next Era of Intelligent Systems
Internship_Presentation_Final engineering.pptx
Project quality management in manufacturing
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
ANIMAL INTERVENTION WARNING SYSTEM (4).pptx
Geodesy 1.pptx...............................................
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
anatomy of limbus and anterior chamber .pptx
Queuing formulas to evaluate throughputs and servers
Lesson 3_Tessellation.pptx finite Mathematics
Road Safety tips for School Kids by a k maurya.pptx
MET 305 MODULE 1 KTU 2019 SCHEME 25.pptx
Structs to JSON How Go Powers REST APIs.pdf
Monitoring Global Terrestrial Surface Water Height using Remote Sensing - ARS...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
CH1 Production IntroductoryConcepts.pptx
web development for engineering and engineering
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...

Expression language

  • 1. GUJARAT TECHNOLOGICAL UNIVERSITY Chandkheda, Ahmedabad Affiliated G. H. Patel College of Engineering and Technology, VallabhVidyanagar A Presentation On Expression Language Under subject of ADVANCED JAVA Semester – VI Computer Engineering Submitted by: Hemant Suthar(130110107058) Submitted to: Prof. Hetal Gaudani
  • 2. Content • Definition • Methods used to call Java Code • Benefits of EL • Types of EL • References
  • 3. Definition • EL is a language that allows JSP programmers to fetch application data stored in JavaBeans component.
  • 4. Methods used to call Java Code • The following methods are used to call the java code from a JSP page: • 1. Placing the entire Java code in a JSP page • 2. Defining separate helper classes that encapsulate the entire Java code and calling these helper classes from a JSP page • 3. Using JavaBeans and JSP page action tags • 4. Using JSP EL • 5. Create tag handler classes to embed the Java code
  • 5. Benefits of EL • The incorporation of EL to the JSP has helped reduce the use of scriptles in JSP page. • EL expressions provide short hand notations to retrieve, present, and manipulate Web application data.
  • 6. Basics of EL • EL expressions are enclosed between the ${ and} characters. • The most general example of an EL expression is ${object.data} • Where, object can be any Java object representing different scope, such as request, session.
  • 7. Types of EL • EL expression tags can be categorized into the following types: • 1. Immediate and deferred expressions • 2. Value expressions • 3. Method expressions
  • 8. Immediate and deferred expressions • Two constructs are used to represent EL expressions, JSP{ expr } used for expressions that need to be evaluated immediately, and  #{ expr } used for expressions that need to be evaluated at later time. • An expression that uses ${ expr } is called immediate expression and • The expression that uses #{ expr } is called deferred expression
  • 9. Value Expressions • Value expressions are used to refer to objects such as JavaBeans, Collections, enumerations and implicit objects and their properties. • An object is referred to by using the value expression containing the name of the object • Suppose the ${ employee } expression is used in a JSP page, where employee refers to the name of a JavaBean • Which searches for the employee JavaBean in the request, session and application scopes • If the employee JavaBean does not exist. a null value is returned.
  • 10. Continue… • Syntax of value expression to access properties and elements of a collection in java uses two operators. ( . ) and ( [] ). • For example. The name property of the employee JavaBean can be referred as ${employee.name} or ${ employee[“name"] } expression. To access a specific element of a collections such as list or an array inside a JavaBean we can use ${ employee.name[0] }, ${ employee.name[1] }, etc...
  • 11. Continue… • The value expressions are of two types: • rvalue rvalue expression can only read data, and not write data. • lvalue lvalue expression can read as well as write data.
  • 12. Method Expressions • Method expressions are used to call public methods. which returns a value or object. • Such expressions are usually deferred expressions. • Tags usually use method expressions to call functions that perform operations such as validating a UI component or handling the events generated on a UI component. • The following code snippet shows the use of method expressions in JSF page:
  • 13. Continue… <h:form> <h:inputText id="email" va1ue="#{employee.email} validator="# {employee.validateEmail} " /> <h:commandButton id="submit" action="#{customer.submit}" /> </h:form>
  • 14. Continue… • The various elements shown in the preceding code snippet can be briefly described as follows: • The inputText tag : shows the Ullnput component in the form of a text field on a webpage. • The validator attribute : calls the validateEmail method of the employee JavaBean. • The action attribute of the commandButton tag : calls the submit method, which carries out processing after submitting the webpage. • The submit method : Refers to the method that is called during the invoke application phase of the JSP life cycle.