Java Beans.

Slides:



Advertisements
Similar presentations
VirtualSim Inc. Real tools for virtual worlds Presentation.
Advertisements

When is Orientated Programming NOT? Mike Fitzpatrick.
Master Pages, User Controls, Site Maps, Localization Svetlin Nakov Telerik Corporation
Apache Struts Technology
Java Beans & Serialization CS-328 Dick Steflik. Java Beans Java based component technology –originally developed to provide java with a component technology.
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
JSP Tag Extensions And Java Bean. JSP Tag Extensions Tag extensions look like HTML (or rather, XML) tags embedded in a JSP page. They have a special meaning.
Basic OOP Concepts and Terms
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
JavaBeans introduction Klaus-Peter Heidrich for the University of Karlstad Inst. for Information Technology Dept. of Computer Science.
Introducing Longhorn. What is it? Longhorn is Microsoft’s “most important software release since Windows 95” – due for release 2006 What this talk covers.
JavaBeans A component architecture. What is JavaBeans? NC World (New Computing) Dictionary: JavaBeans n. 1. JavaSoft technology. 2. Component object model.
JAVA BEANS By Madhuri Kakumanu. What is a Java Bean? “ A Java Bean is a reusable software component that can be visually manipulated in builder tools.”
Structure of a web application1 Dr Jim Briggs. MVC Structure of a web application2.
Apache Struts Technology A MVC Framework for Java Web Applications.
M.Sc. Course, Dept. of Informatics and Telecommunications, University of Athens S.Hadjiefthymiades “Web Application Servers” Basics on WAS WAS are necessary.
Introducing JavaBeans Lesson 2A / Slide 1 of 30 JDBC and JavaBeans Pre-assessment Questions 1.Which of the given symbols is used as a placeholder for PreparedStatement.
Introducing JavaBeans Identify the features of a JavaBean Create and add a bean to an application Manipulate bean properties using accessor and mutator.
Java Beans Component Technology Integrated, Visual Development Environments Reusable Platform-Independent Modular.
Java Pet Store Application. Outline Introduction Introduction Information Layer Information Layer Application Layer Application Layer Infrastructure Layer.
UNIT-V The MVC architecture and Struts Framework.
JavaServer Faces: The Fundamentals Compiled from Sun TechDays workshops (JSF Basics, Web-Tier Codecamp: JavaServer Faces, Java Studio Creator; IBM RAD)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
GIS technologies and Web Mapping Services
1 CHAPTER 1 OVERVIEW of JDEVELOPER. 2 Overview of JDeveloper Oracle’s JDeveloper 10g (JDeveloper) is an integrated development environment for Java programming.
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
SWE 316: Software Design and Architecture Objectives Lecture # 19 Java Beans SWE 316: Software Design and Architecture  Understand  what JavaBeans (“Beans”)
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
JavaBeans Components. To understand JavaBeans…  Proficient experience with the Java language required  Knowledge of classes and interfaces  Object-Oriented.
Learning objectives By the end of this lecture you should be able to:  have a well-earned rest! Ch 24 Beyond the second semester.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
Object Oriented Software Development 9. Creating Graphical User Interfaces.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
1 First BlueJ Day, Houston, Texas, 1st March 2006 Writing BlueJ Extensions Ian Utting University of Kent.
Java Programming: Advanced Topics 1 JavaBeans Chapter 8.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
Object Oriented Software Development 10. Persistent Storage.
JSP Tag Libraries Lec Last Lecture Example We incorporated JavaBeans in “Course Outline” Example But still have to write java code inside java.jsp.
Java Bean Definition “A Java Bean is a reusable software component that can be manipulated visually in a builder tool.”
1 Java Server Pages Allows the embedding of Java commands in a page of HTML. Popular for UI heavy solutions. These commands are then interpreted by a JSP.
Introduction to Java Beans CIS 421 Web-based Java Programming.
Java Beans. Definitions A reusable software component that can be manipulated visually in a ‘builder tool’. (from JavaBean Specification) The JavaBeans.
ASP.NET Web Services.  A unit of managed code installed under IIS that can be remotely invoked using HTTP.
ANDROID AND MODEL / VIEW / CONTROLLER. Slide 2 Design Patters Common solutions to programming problems are called design patterns Design patterns are.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
Introduction to Software Components: the JavaBeans specs Babak Esfandiari.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 32 JavaBeans and Bean.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Java Beans THETOPPERSWAY.COM. Contents What is a Java Bean? Advantages Properties Bean Developers Kit (BDK) What makes Bean possible? Support for Java.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
Slides prepared by Rose Williams, Binghamton University Chapter 20 Java Never Ends.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
SDJ INFOSOFT PVT. LTD. 2 BROWSERBROWSER JSP JavaBean DB Req Res Application Layer Enterprise server/Data Sources.
Apache Struts Technology A MVC Framework for Java Web Applications.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
JAFER Toolkit Project Oxford University 1 JAFER Java-based high level Z39.50 toolkit Matthew Dovey; Colin Tatham; Antony Corfield; Richard Mawby Oxford.
The Holmes Platform and Applications
Structure of a web application
Java Beans Sagun Dhakhwa.
JavaBeans and JSP CS-422.
VISUAL BASIC.
Building an Integrable XBRL Portal Daniel Hamm German Central Bank
JavaServer Faces: The Fundamentals
Java Programming: Advanced Topics
SDMX IT Tools SDMX Registry
Presentation transcript:

Java Beans

What is a Java Bean? Component An artifact that is one of the individual parts of which makes a composite entity Usually a component is a part that can be separated from or attached to a system or module in a system A Java Bean bears a strong resemblance to a well-written Java application. But since it is a component, a Bean's scope is usually smaller than that of an entire application, making it easier to develop.

Contd… A Java bean is a reusable software component Java Beans is the de-facto component model in Java world Java Bean is NOT AN Enterprise Java Bean (EJB) Frameworks and Tools can use Java Bean components to build something bigger Example 1: An address component holds address of a person in a program Example 2: A text box is a reusable component of a screen

Contd… A Java Bean is a reusable software component that can be visually manipulated in builder tools. The JavaBeans API makes it possible to write component software in the Java programming language.

Features of Java Beans Java Beans API provides a framework for defining software components that are Reusable: Component which is capable of being used again and again Embeddable: Component which is expected to function without human intervention. Modular: A solution made of several discrete pieces, so that any piece can be replaced without rebuilding the whole solution Advantages of Java Beans:

Allows creation of reusable components Library of reusable components can be built Third Party library of components can be used to build an application Frameworks and Builder tools which use Java Beans components use Java Reflection API to handle components

A Simple Java Beans class Employee { private int employeeNumber; private String employeeName; ... public void setEmployeeNumber (int employeeNumber) { this.employeeNumber =employeeNumber; } public int getEmployeeNumber() { return employeeNumber; } public void setEmployeeName (String employeeName) { this.employeeName = employeeName; } public String getEmployeeName() { return employeeName; } }

Simple Java Bean Employee Class Results in an Employee Bean Has all data members private Does not have a constructor A pair of public Get/Set methods for all or most member variables Names of Get/Set methods should match the variable names Results in an Employee Bean Has properties employeeNumber employeeName

Bean Class name: Any user defined name Should not have a constructor Properties What makes up a property? Example: A private data member called ‘employeeNumber’ A public get method by name ‘getEmployeeNumber’ A public set method by name ‘setEmployeeNumber’ Together these three form a property of a bean called ‘EmployeeNumber’ Note: Method names and variables names are case sensitive

Why Java Beans? Many real life situations require components to work with various frameworks and libraries Data is in text files, XML files or other textual forms have to be mapped programmatically in many applications Names in text form can be mapped to variable names of a class Example:

Use of Java beans is more in Server side code than the GUI code <Employee> <employeeNumber>29853</employeeNumber> <employeeName>Tom</employeeName> ... </Employee> This is one of the reasons why Java Beans is used extensively in both UI frameworks and Server side code Use of Java beans is more in Server side code than the GUI code

Properties Properties are Discrete attributes of a Bean that are referenced by name Example: “EmployeeNumber” is a property of EmployeeBean Value of a property can be read programmatically by using a name

Where do we use Java Beans? Data handling and data intensive applications for mapping textual data to variables Server side applications which use component based design Web technologies and related frameworks like JSP, Struts etc JSP Tag beans Struts is a framework for presentation layer of Java based web applications GUI applications based on Java Beans components Rarely used because of limited scope of Java in GUI applications

Java Beans in User Interface BDK (Bean Development Kit) was a specification from Sun for creating and using reusable UI based Java Beans Difference in UI Java Beans compared to Simple Java Beans Methods to draw on screen are provided Methods to persist data and settings Persistence: storing data of an object in a non-volatile manner and retreiving it when required

Contd… Event Handling methods to respond to user action on UI components Customization of component’s features which are visible graphically Application Builder or similar GUI frameworks can understand and use these components to build GUI Screens

Java Beans in User Interface (Bean Development Kit – BDK) Application Builder tool and other GUI Frameworks are available for are creating/ using Java Beans Tool display all the properties and events offered by a Java Bean in a toolbar in the development environment Developer can manipulate properties and write event handler code in development environment Properties can also be manipulated programmatically

Application Builder Tool Java Bean components (Classified in tabs) Application Builder Tool Properties Window – Displays properties of selected bean List of events supported

Sample Java Beans used in User Interface Button Bean Slider Bean

Advantages of Java Beans The main purposes of Java Beans are closely related to the main advantages of Java technology. The advantages includes Platform independence Mobility in a networked environment. Expose accessor methods (e.g. getValue() and setValue()) to allow retrieval and changing of attribute values by external sources. Allow for easy mixing and matching via GUI development tools. Generate or respond to appropriate events. Save their state using the Java Serialization mechanism. Compact and Easy Leverages the Strengths of the Java Platform