SlideShare a Scribd company logo
Java Beans
What are Java Beans?


JavaBean is a specially constructed Java class
written in the Java and coded according to the
JavaBeans API specifications.



Characteristics of a JavaBean:







It provides a default, no-argument constructor.
It should be serializable and implement the Serializable
interface.
It may have a number of properties which can be read or
written.
It may have a number of "getter" and "setter" methods for
the properties.
JavaBeans Properties


A JavaBean property may be read, write, read only,
or write only.



JavaBean properties are accessed through two
methods


getPropertyName()




For example, if property name is firstName, your method name
would be getFirstName() to read that property. This method is
called accessor.

setPropertyName()


For example, if property name is firstName, your method name
would be setFirstName() to write that property. This method is
called mutator.
Expression Language (EL)


Expression Language (EL) makes it possible to
easily access application data stored in JavaBeans
components.







Arithmetic
logical

Within a JSP EL expression, you can use integers,
floating point numbers, strings, the built-in constants
true and false for boolean values, and null.
JSP EL allows you to specify an expression for any
of these attribute values. A simple syntax for JSP EL
is as follows:


${expr}
Expression Language (EL)


Here expr specifies the expression itself. The most
common operators in JSP EL are . and []. These two
operators allow you to access various attributes of Java
Beans and built-in JSP objects.



For example above syntax <jsp:setProperty> tag can be
written with an expression like:




<jsp:setProperty name="box" property="perimeter"
value="${2*box.width+2*box.height}"/>

When the JSP compiler sees the ${} form in an attribute,
it generates code to evaluate the expression and
substitutes the value of expression.
Expression Language (EL)


You can include a JSP EL expression in the body of a
<jsp:text> tag (or any other tag) with the same ${} syntax
you use for attributes.
<jsp:text>
Box Perimeter is: ${2*box.width + 2*box.height}
</jsp:text>



To deactivate the evaluation of EL expressions, we
specify the isELIgnored attribute of the page directive as
below:




<%@ page isELIgnored ="true|false" %>

If it is true, EL expressions are ignored when they
appear in static text or tag attributes. If it is false, EL
expressions are evaluated by the container.
Operators in EL
Operator

Description

.

Access a bean property or Map entry

[]

Access an array or List element

()

Group a sub-expression to change the evaluation order

+

Addition

-

Subtraction or negation of a value

*

Multiplication

/ or div

Division

%

Modulo (remainder)

== or eq

Test for equality

!= or ne

Test for inequality

< or lt

Test for less than

> or gt

Test for greater than

<= or le

Test for less than or equal

>= or gt

Test for greater than or equal
Operators in EL
Operator

Description

&& or and

Test for logical AND

|| or or

Test for logical OR

! or not

Unary Boolean complement

empty

Test for empty variable values

More Related Content

PPT
Introduction to java beans
Hitesh Parmar
 
PPTX
Java Beans
Ankit Desai
 
PDF
13 java beans
snopteck
 
PPT
Bean Intro
vikram singh
 
PPTX
Java beans
Rajkiran Mummadi
 
PPTX
Java Beans Unit 4(part 2)
Dr. SURBHI SAROHA
 
PPT
Java beans
Umair Liaqat
 
Introduction to java beans
Hitesh Parmar
 
Java Beans
Ankit Desai
 
13 java beans
snopteck
 
Bean Intro
vikram singh
 
Java beans
Rajkiran Mummadi
 
Java Beans Unit 4(part 2)
Dr. SURBHI SAROHA
 
Java beans
Umair Liaqat
 

What's hot (20)

PDF
Introduction to JPA and Hibernate including examples
ecosio GmbH
 
PPTX
Introduction to JPA (JPA version 2.0)
ejlp12
 
PPTX
Introduction to JPA Framework
Collaboration Technologies
 
PDF
JPA and Hibernate
elliando dias
 
PPT
EJB Clients
Roy Antony Arnold G
 
DOCX
Computer Programming 2
VasanthiMuniasamy2
 
PPT
jpa-hibernate-presentation
John Slick
 
PPT
hibernate with JPA
Mohammad Faizan
 
PPTX
Jsp Introduction Tutorial
APSMIND TECHNOLOGY PVT LTD.
 
PPTX
Spring (1)
Aneega
 
PPT
Hibernate Tutorial
Ram132
 
PPTX
Hibernate inheritance and relational mappings with examples
Er. Gaurav Kumar
 
PPT
Deployment
Roy Antony Arnold G
 
PDF
C# Advanced L07-Design Patterns
Mohammad Shaker
 
PPTX
JPA For Beginner's
NarayanaMurthy Ganashree
 
PPTX
Object oriented programming in php
Aashiq Kuchey
 
PPT
Intro To Hibernate
Amit Himani
 
PPTX
Hibernate
Prashant Kalkar
 
PPT
Java Persistence API (JPA) Step By Step
Guo Albert
 
PPTX
Hibernate ppt
Aneega
 
Introduction to JPA and Hibernate including examples
ecosio GmbH
 
Introduction to JPA (JPA version 2.0)
ejlp12
 
Introduction to JPA Framework
Collaboration Technologies
 
JPA and Hibernate
elliando dias
 
EJB Clients
Roy Antony Arnold G
 
Computer Programming 2
VasanthiMuniasamy2
 
jpa-hibernate-presentation
John Slick
 
hibernate with JPA
Mohammad Faizan
 
Jsp Introduction Tutorial
APSMIND TECHNOLOGY PVT LTD.
 
Spring (1)
Aneega
 
Hibernate Tutorial
Ram132
 
Hibernate inheritance and relational mappings with examples
Er. Gaurav Kumar
 
C# Advanced L07-Design Patterns
Mohammad Shaker
 
JPA For Beginner's
NarayanaMurthy Ganashree
 
Object oriented programming in php
Aashiq Kuchey
 
Intro To Hibernate
Amit Himani
 
Hibernate
Prashant Kalkar
 
Java Persistence API (JPA) Step By Step
Guo Albert
 
Hibernate ppt
Aneega
 
Ad

Viewers also liked (11)

PPTX
Javabeans
vamsitricks
 
PDF
Using java beans(ii)
Ximentita Hernandez
 
PDF
Java Course 14: Beans, Applets, GUI
Anton Keks
 
PPT
Java beans
Ramraj Choudhary
 
PDF
Java beans
Mukesh Tekwani
 
PDF
javabeans
Arjun Shanka
 
PPT
introduction of Java beans
shravan kumar upadhayay
 
PDF
Java beans
Ravi Kant Sahu
 
PPT
Java beans
sptatslide
 
PPT
Code Division Multiple Access- CDMA
ViVek Patel
 
PPTX
IS-95 Cdma
yogesh singh
 
Javabeans
vamsitricks
 
Using java beans(ii)
Ximentita Hernandez
 
Java Course 14: Beans, Applets, GUI
Anton Keks
 
Java beans
Ramraj Choudhary
 
Java beans
Mukesh Tekwani
 
javabeans
Arjun Shanka
 
introduction of Java beans
shravan kumar upadhayay
 
Java beans
Ravi Kant Sahu
 
Java beans
sptatslide
 
Code Division Multiple Access- CDMA
ViVek Patel
 
IS-95 Cdma
yogesh singh
 
Ad

Similar to Java beans (20)

PPTX
Expression language
Hemant Suthar
 
PPTX
Advance java session 14
Smita B Kumar
 
PDF
15 expression-language
snopteck
 
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
WebStackAcademy
 
PPTX
EXPRESSIONS IN JSP and Expression language in JSP
22B81A1246cvracinKAN
 
PPSX
Java server pages
Tanmoy Barman
 
PPT
Unified Expression Language
BG Java EE Course
 
PPTX
Java
proximotechsoft
 
PDF
java beans
lapa
 
PDF
JSP Standard Tag Library
Ilio Catallo
 
PPTX
Learn Java in 2 days
AĦɱëđ Ǥhaly
 
PPTX
Core Java introduction | Basics | free course
Kernel Training
 
PPT
java-corporate-training-institute-in-mumbai
vibrantuser
 
PPT
java-corporate-training-institute-in-mumbai
Unmesh Baile
 
PPT
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
PPT
Java Simple Introduction in single course
binzbinz3
 
PPSX
Core Java Basics
Fayis-QA
 
PPT
Java
Manav Prasad
 
PPTX
Session 36 - JSP - Part 1
PawanMM
 
PPTX
Java tutorial for beginners-tibacademy.in
TIB Academy
 
Expression language
Hemant Suthar
 
Advance java session 14
Smita B Kumar
 
15 expression-language
snopteck
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
WebStackAcademy
 
EXPRESSIONS IN JSP and Expression language in JSP
22B81A1246cvracinKAN
 
Java server pages
Tanmoy Barman
 
Unified Expression Language
BG Java EE Course
 
java beans
lapa
 
JSP Standard Tag Library
Ilio Catallo
 
Learn Java in 2 days
AĦɱëđ Ǥhaly
 
Core Java introduction | Basics | free course
Kernel Training
 
java-corporate-training-institute-in-mumbai
vibrantuser
 
java-corporate-training-institute-in-mumbai
Unmesh Baile
 
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
Java Simple Introduction in single course
binzbinz3
 
Core Java Basics
Fayis-QA
 
Session 36 - JSP - Part 1
PawanMM
 
Java tutorial for beginners-tibacademy.in
TIB Academy
 

Recently uploaded (20)

PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 

Java beans

  • 2. What are Java Beans?  JavaBean is a specially constructed Java class written in the Java and coded according to the JavaBeans API specifications.  Characteristics of a JavaBean:     It provides a default, no-argument constructor. It should be serializable and implement the Serializable interface. It may have a number of properties which can be read or written. It may have a number of "getter" and "setter" methods for the properties.
  • 3. JavaBeans Properties  A JavaBean property may be read, write, read only, or write only.  JavaBean properties are accessed through two methods  getPropertyName()   For example, if property name is firstName, your method name would be getFirstName() to read that property. This method is called accessor. setPropertyName()  For example, if property name is firstName, your method name would be setFirstName() to write that property. This method is called mutator.
  • 4. Expression Language (EL)  Expression Language (EL) makes it possible to easily access application data stored in JavaBeans components.     Arithmetic logical Within a JSP EL expression, you can use integers, floating point numbers, strings, the built-in constants true and false for boolean values, and null. JSP EL allows you to specify an expression for any of these attribute values. A simple syntax for JSP EL is as follows:  ${expr}
  • 5. Expression Language (EL)  Here expr specifies the expression itself. The most common operators in JSP EL are . and []. These two operators allow you to access various attributes of Java Beans and built-in JSP objects.  For example above syntax <jsp:setProperty> tag can be written with an expression like:   <jsp:setProperty name="box" property="perimeter" value="${2*box.width+2*box.height}"/> When the JSP compiler sees the ${} form in an attribute, it generates code to evaluate the expression and substitutes the value of expression.
  • 6. Expression Language (EL)  You can include a JSP EL expression in the body of a <jsp:text> tag (or any other tag) with the same ${} syntax you use for attributes. <jsp:text> Box Perimeter is: ${2*box.width + 2*box.height} </jsp:text>  To deactivate the evaluation of EL expressions, we specify the isELIgnored attribute of the page directive as below:   <%@ page isELIgnored ="true|false" %> If it is true, EL expressions are ignored when they appear in static text or tag attributes. If it is false, EL expressions are evaluated by the container.
  • 7. Operators in EL Operator Description . Access a bean property or Map entry [] Access an array or List element () Group a sub-expression to change the evaluation order + Addition - Subtraction or negation of a value * Multiplication / or div Division % Modulo (remainder) == or eq Test for equality != or ne Test for inequality < or lt Test for less than > or gt Test for greater than <= or le Test for less than or equal >= or gt Test for greater than or equal
  • 8. Operators in EL Operator Description && or and Test for logical AND || or or Test for logical OR ! or not Unary Boolean complement empty Test for empty variable values