Top Banner

of 68

Project Report on Online-Banking

Apr 05, 2018

Download

Documents

kavitaverma
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/31/2019 Project Report on Online-Banking

    1/68

    ONLINE BANKING

    PROJECTREPORT

    Submitted in partial fulfilment of the requirements for theAward of THE degree of

    BACHELOR OF TECHNOLOGYIN

    COMPUTER ENGINEERING(2007-2011)

    Project Guide Head Mentor

    Mrs.Deepti Gupta Mr. Prosanta

    Gope

    Asst. Prof. (CE Deptt.) Asst.

    Prof. ( IT Deptt.)

    DEVELOPED BY:-

    Jatin Behl(07CE019)

    Vinitesh Gulati(07CE063)

  • 7/31/2019 Project Report on Online-Banking

    2/68

    CERTIFICATE

    This is to certify that the project entitled Online Banking inJ2EE and ORACLE undertaken by:Vinitesh&Jatin studentof T.I.T&S (Bhiwani)(Bhiwani) in partial fulfilment of the requirements

    for the award of the degree of Bachelor of technology inComputer engineerig, embodies the work done by him underour supervision.

    Project Guide: Project Mentor:

    Ms. Deepti Gupta PROSANTA GOPE

    Asstt. Professor Asstt. Professor

    (CE Deptt.) (CE Deptt.)

  • 7/31/2019 Project Report on Online-Banking

    3/68

    ACKNOWLEDGEMENT

    I take this opportunity to express my sincere thanks and deepgratitude to all those people who extended their whole heartedco-operation and have helped us in completing this project.With deep sense of gratitude, we express our thanks to myproject guide Mr.PROSANTA GOPE his able guidance andvaluable suggestion that were very much required for thecompletion of this project.

    I express my humble gratitude to Mr.Prosanta Gope forproviding us useful guidance and personally inspecting mywork. He has been the key factor and motivating force insuccessful completion of this project.Under his guidance this project never posed a problem to us.We are also thankful to our teachers who supported us inmaking this project a real success. Our parents who

    encouraged us at each and every step.

    Jatin

    Behl(07ce019)Vinitesh

    Gulati(07ce063)

    OBJECTIVE OF THE PROJECT

  • 7/31/2019 Project Report on Online-Banking

    4/68

    The main objective of this project is to provide easymaintenance of the customer information and their accounts inthe banks. It is also used to reduce the work load by reducingthe bulk paper work and also by generating automated databased reports for the review of transactions in new or oldaccounts of respective customers. It reduces the tediousmental task to develop a record of all the information for thecustomer accounts.

    The Online Banking System is an important part of any Bankor any type of management. This project has been developedwith the objective to develop Online Banking System for anybank with very little effort. It manages the record of all thecustomers, their personal details, annual income and recordsof new & old transactions.

    CONTENTS

  • 7/31/2019 Project Report on Online-Banking

    5/68

    SR.NO DESCRIPTION

    1. Introduction to the project

    2. Platform used

    3. Software development & life Cycle

    4. J2EE(Java 2 Enterprise Edition)

    5. JSP,Servlet & EJB Introduction

    6. Project Design

    7. Modules & their description

    8. E-R Diagram

    9. Future Scope of the project

    10. Conclusion

    11. Bibliography

  • 7/31/2019 Project Report on Online-Banking

    6/68

    INTRODUCTION TO THE PROJECT

    Before we will start with the introduction of our project that isONLINE BANKING, we must see what its name suggests.

    With this it must be clear that what sort of information is

    maintained in our project. So firstly, let us introduce what its

    name suggests. Basically our project is used to perform online

    transactions without going to a bank which provides more

    convenience to its customers. It is helpful in reducing all thepaper work performed in the banks.

    It is an important part of any bank or any management system.

  • 7/31/2019 Project Report on Online-Banking

    7/68

    PLATFORM USED

    Hardware Required-

    (i) 512 MB RAM.(ii) Pentium 4 or equivalent processor.

    Software Required-(i) JDK 1.5 or 1.6(ii) Oracle (Database)(iii) Apache Tomcat web server(iv) Eclipse

    Technology Used-(i) J2EE(ii) SERVLET, JSP, JDBC, JND, RMI(iii) TOMCAT SERVER or J2EE SERVER

    Platform- Windows 7 or VISTA

    Backup Media- Hard Disk.

    This software is developed using Windows-XP as systemsoftware and is tested to be executed on all the operatingsystems given above.

  • 7/31/2019 Project Report on Online-Banking

    8/68

    SYSTEM DEVELOPMENT LIFE

    CYCLEIntroduction: -

    Every computer-based system has a life cycle. Just as a living beingsfollow a life cycle. Commercial programs such as payroll accounts,inventory and other software share a common life cycle pattern. Onemethod of doing things may work well for a period of time. At this

    point investigations are made, requirements are analyzed, and newspecifications are proposed and a new system is developed. The lifecycle of the new system thus starts again.System development starts when management or sometimes systemdevelopment personnel feel that a new system or an improvement inthe existing system is required. The systems development life cycle isclassically thought of as the set of activities that analysts, designers andusers carry to develop and implement an information system.We can also call it software development life cycle as a software is asystem is its whole.

    Phases of the System Development Life Cycle :-

    System Development Life Cycle (SDLC) is a well-defined process bywhich a system is conceived, developed and implemented. The systemdevelopment life cycle consists of the following phases.

    1. Preliminary survey or Investigation2. Feasibility Study3. System Analysis4. Design of System5. Development of Software6. System Testing7. Implementation and evaluation8. Maintenance

  • 7/31/2019 Project Report on Online-Banking

    9/68

    So in my project system I have followed almost every step required tobe followed while developing the system.

    Preliminary Survey:-

    One of the most difficult tasks of the system analyst is identifying thereal problem of the existing system. Without clear understanding of the

    problem in the system, any further work done will lead to wastage ofeffort at a later stage. While doing preliminary survey for my project Ifound that the present system in used is a manual system. Which was

    not capable of fulfilling the entire requirement? At the same timemanual system is responsible for wastage of time effort and money. Sothere is a need of computerized Bookshop information system.Feasibility Study: The next step is to examine the feasibility of the

    proposed system. This involves evaluating the costs and benefits of thesystem. While feasibility studies I found that my system is feasible intechnical, economical and operational point of views.

    Technical feasibility:

    During this study, the analyst identifies the existing computer systems(hardware and software) of the concerned department and determineswhether these technical resources are sufficient for the proposed systemor not. I found my system is feasible in this point of view.

    Economic Feasibility:

    Economic feasibility is the most important study that determines thecost and benefits of the proposed system and compares with the budget.I found that my project is feasible in this point of view.

    Operational Feasibility:

  • 7/31/2019 Project Report on Online-Banking

    10/68

    During operational feasibility study, it is determined whether thesystem will operate in the way that user wants or not. This test offeasibility asks if the system will work when it is developed andinstalled. I found that my project is also feasible in this point of view.

    System Analysis:

    When the systems analyst decides that the requested system is feasibleand the management agrees to continue the development process thenext phase of SDLC is determination of systems requirements. Duringthe system analysis we use mainly two methods to collect thatinformation and interview of the concern person. A part from that

    various tools of structure analysis like flow chart DFD are also used tomake a clear understanding of the system.

    Design of System:

    In the system design phase, the primary objective is to identify userrequirements and to build a system that satisfies these requirements,systems specialists often refer to this stage as logical design, in contrast

    to the process of developing program software, which is referred to asphysical design.During design false of my project the first step was identification ofdata requirement (input requirement, storage devices, output devicesetc.) In the next step I develop the database for my project in Microsoftaccess as back-end in the next step I moves to words form designingcoding in Visual studio as front-end .In next step was connection ofdatabase with my form using ado connectivity.

    Development of Software:

    In this phase, the system is actually programmed. The analyst shoulddecide whether to buy commercial software or to develop newcustomized programs with the help of programmers.Programmers are also responsible for documenting the program,

    providing an explanation of how and why certain procedure is coded inspecific ways.

  • 7/31/2019 Project Report on Online-Banking

    11/68

    System Testing:

    The main purpose of this phase is to find the errors and correct them. Asuccessful test is one, which finds an error.When my system becomes ready to be implemented next step wassystem testing. Various type of testing procedure used by me in my

    project:1. Unit testing 2.Module testing 3.Sub testing 4.System

    testing

    Implementation and Evaluation :

    Implementation consists of installing hardware, software, training of allthe users and collecting data needed to use it. Therefore, this phaseinvolves training of the users for using the system and also providingthem friendly documentation to refer to. So my system ready to bealmost to proposed system.

  • 7/31/2019 Project Report on Online-Banking

    12/68

    J2EE(Java 2 enterprise edition)

    Introduction to Java Programming

    Java is a powerful object-oriented programming language introducedby Sun Microsystems in 1995, which has built-in support to createprograms with a graphical user interface (GUI), utilize the Internet,create client-server solutions, and much more. Programs written in Java

    can run, without change, on any of the common computer operatingsystems Windows 95/NT, Macintosh, and UNIX. A variant of Javaprograms called applets can be embedded inside a web page andexecute on the computer that is viewing the page, automatically and ina secure environment.

    As a language, Java is closely related to C++, which is also object-oriented but retains a lot of idiosyncrasies inherited from its

    predecessor language C. Java has removed the inconsistent elementsfrom C++, is exclusively object-oriented, and can be considered amodern version of C++. Because of its logical structure Java hasquickly become a popular choice as a teaching language, and becauseof its extensive Internet support and the promise of writing programsonce and using them on every operating system Java is becoming moreand more accepted in industry.

    2. What is Java?

    Java is a programming language for producing programs which arecomputer, or platform independent. This simply means that the same

    program will run on different computers without modification. Forexample, WordPerfect can currently be used on PCs or Macintoshes;however different versions of the same program are required for eachcomputer type.

  • 7/31/2019 Project Report on Online-Banking

    13/68

    Java was also the first programming language to be used to provideexecutable content on the WWW. In this context executable contentgenerally refers to programs. Small programs known as applets can bewritten in the Java language. These applets can be loaded as part of aweb page to give the page some intelligence (providing the browsersupports applets). For example, an applet could be loaded as part of aWWW order form to perform calculations and display a running cost asthe purchaser adds items to or removes items from the order form. Thissimple example demonstrates how Java is bringing new levels ofinteractivity to the WWW

    3. J2EE Web Application Components

    Java Servlets Extend off of HttpServlet

    JSP pages, normally for Presentation

    Java Beans Normally used as value objects, pass to data to JSPs

    Tag Libraries XML based JSP elements

    Web Deployment Descriptor /web-inf/web.xml

    Servlet

  • 7/31/2019 Project Report on Online-Banking

    14/68

    Java Servlets/JSP are part of the Suns J2EE Enterprise Architecturethat is the web development part. Java Servlet is a simple, consistent

    mechanism for extending the functionality of a web server.They are precompiled Java programs that are executed on theserver side and require a Servlet container to run in the program and thelatest Servlet Specification is 2.3.

    We use Servletsbecause they work well in a HeterogeneousEnvironments.They are OS and platform independent.Also they workwith all major web servers (Sun App,Apache Tomcat,Jboss,etc).Theyhave well defined Web Architecture framework and standard built in

    services such as: Standard Approach to Authentication

    Database connection pooling

    Complete support for sessions via cookies and/orURL re-writing

    A servlet has clean separation of Controller/Logic from PresentationIt is more efficient than others.There are free Servlet/JSP containersand connectors that run under both UNIX and win32.

    Web Deployment Descriptor :-

    /web-inf/web.xml Part of the standard Defines servlets used in the web application Maps servlets to URLs A servlet can map to many URLs

    Defines resources available to the web app

    Defines security constraints

    Defines other stuff like Welcome file list Session timeout Error page mapping

    Java Server Page (JSP)

  • 7/31/2019 Project Report on Online-Banking

    15/68

    It is a simplified, fast way to create dynamic web content. It is mainlyHTML or XML pages with embedded Java Code.Java Beans can be a

    mix of template data in HTML/XML with some dynamic content. AJSP page is first converted into a Java Servlet automatically by theServlet container, and then it is cached or executed. Latest JSPSpecification is 1.2.

    JSP Constructs 1:-

    Used in JSP pages, pages that end *.jsp

    Comment Declaration

    Expression Outputs to the Response stream Like a printf to the browser Do NOT use semi-colon to terminate the line

    Scriplets - contains Java Code

    JSP Constructs 2:-

    The value is:

    Value is empty

    Implicit objects always available in the JSP Page1.request-Browsers Request Object(use to get HTTP headers,length etc)

    2.response-HttpResponse Object

    JSP Constructs 3 :-

  • 7/31/2019 Project Report on Online-Banking

    16/68

    session internal HttpSession Object pageContext application out, same as config servlet configuration page exception

    JSP Directives Are messages or instructions to the JSP container

    JSP Constructs 4 :-

    Do not produce any output page directive

    Commonly used for importing class paths include directive

    Good for including static content taglib lists the tag library descriptor location

    Required when using tab libraries

    Java Beans as Used in Web Apps

    Normally used for all data transfers and business components

    Similar to how Java Beans are used in Swing and AWT But do not need the full implementation

    Must have no constructor or no-arg constructor

    Must have setter and getter methods for each property value

    JSP constructs/tags use Java Beans

  • 7/31/2019 Project Report on Online-Banking

    17/68

    JSP Actions :-

    JSP actions are special tags that affect the output stream and are

    normally used with Java beans Most commonly used:

    ,,

    The code below will display the lastName property ofthe student bean on the output stream

    Servlet Container/Engine :-

    Servlets/JSP requires a Container

    Apache Tomcat is the reference implementation of theServlet/JSP Specs

    It is open source, small, install quickly,and is FREE Latest Version is 4.1.24

    Web Site: jakarta.apache.org/tomcat

    It includes a simple HTTP 1.1 server, good enough fordevelopment and small intranets.

    Tomcat Install :-

    Requires a JDK, get 1.4.1 and install into c:\jdk or $HOME/jdk

    Add JAVA_HOME to your environment and the bin directoryto your PATH

    Good practice to unpack into c:\tomcat or $HOME/tomcat

    Add CATALINA_HOME to your environment and the bindirectory to your PATH

    Tomcat Directory Structure :-

  • 7/31/2019 Project Report on Online-Banking

    18/68

  • 7/31/2019 Project Report on Online-Banking

    19/68

    Distributed Multi-tiered Applications

    The J2EE platform uses a multi-tiered distributed application model.Application logic is divided into components according to function, andthe various application components that make up a J2EE applicationare installed on different machines depending on the tier in the multi-tiered J2EE environment to which the application component belongs.Fig1.1 shows two multi-tiered J2EE applications divided into the tiersdescribed in the following list. The J2EE application parts shown inFig1.1 are presented in J2EE Components. Client-tier components run on the client machine. Web-tier components run on the J2EE server

    Business-tier components run on the J2EE server. Enterprise information system (EIS)-tier software runs on the EISserver.Although a J2EE application can consist of the three or four tiersshown in Fig1.1, J2EE multi-tiered applications are generallyconsidered to be three-tiered applications because they are distributedover three different locations: client machines, the J2EE servermachine, and the database or legacy machines at the back end. Three-

    tiered applications that run in this way extend the standard two-tieredclient and server model by placing a multithreaded application server

    between the client application and back-end storage.

    Figure 1.1 Multi-tiered Applications

  • 7/31/2019 Project Report on Online-Banking

    20/68

    J2EE Components

    J2EE applications are made up of components. AJ2EE componentis aself-contained functional software unit that is assembled into a J2EEapplication with its related classes and files and that communicateswith other components. TheJ2EE specification defines the following J2EE components: Application clients and applets are components that run on the client. Java Servlet and JavaServer Pages (JSP) technology componentsare Web components that run on the server. Enterprise JavaBeans (EJB) components (enterprise beans) are

    business components that run on the server.

    J2EE components are written in the Java programming language andare compiled in the same way as any program in the language. Thedifference between J2EE components and standard Java classes isthat J2EE components are assembled into a J2EE application, verifiedto be well formed and in compliance with the J2EE specification, anddeployed to production, where they are run and managed by the J2EEserver.

    J2EE ClientsA J2EE client can be a Web client or an application client.

    Web ClientsA Web client consists of two parts: dynamic Web pages containingvarious types of markup language (HTML, XML, and so on), which aregenerated by Web components running in the Web tier, and a Web

    browser, which renders the pages received from the server. A Webclient is sometimes called a thin client. Thin clients usually do not dothings like query databases, execute complex business rules, or connectto legacy applications. When you use a thin client, heavyweightoperations like these are off-loaded to enterprise beans executing on theJ2EE server where they can leverage the security, speed, services, andreliability of J2EE server-side technologies.

    Applets

  • 7/31/2019 Project Report on Online-Banking

    21/68

    A Web page received from the Web tier can include an embeddedapplet. An applet is a small client application written in the Java

    programming language that executes in the Java virtual machineinstalled in the Web browser. However, client systems will likely needthe Java Plug-in and possibly a security policy file in order for theapplet to successfully execute in the Web browser. Web componentsare the preferred API for creating a Web client program because no

    plug-ins or security policy files are needed on the client systems. Also,Web components enable cleaner and more modular application design

    because they provide a way to separate applications programming fromWeb page design. Personnel involved in Web page design thus do notneed to understand Java programming language syntax to do their jobs.

    Web Components

    J2EE Web components can be either servlets or JSP pages. Servlets areJava programming language classes that dynamically process requestsand construct responses. JSP pages are text-based documents thatexecute as servlets but allow a more natural approach to creating staticcontent. Static HTML pages and applets are bundled with Web

    components during application assembly, but are not considered Webcomponents by the J2EE specification. Server-side utility classes canalso be bundled with Web components and, like HTML pages, are notconsidered Web components.Like the client tier and as shown in Figure 13, the Web tier mightinclude a JavaBeans component to manage the user input and send thatinput to enterprise beans running in the business tier for processing.

    Business Components

    Business code, which is logic that solves or meets the needs of aparticular business domain such as banking, retail, or finance, ishandled by enterprise beans running in the business tier. Figure 1.4shows how an enterprise bean receives data from client programs,

    processes it (if necessary), and sends it to the enterprise informationsystem tier for storage. An enterprise bean also retrieves data from

    storage, processes it (if necessary), and sends it back to the clientprogram.

  • 7/31/2019 Project Report on Online-Banking

    22/68

    Figure 1.3- Web Tier and J2EE Application

    Figure 1.4 Business and EIS Tiers

    There are three kinds of enterprise beans: session beans, entity beans,and message-driven beans. A session bean represents a transientconversation with a client.When the client finishes executing, thesession bean and its data are gone. In contrast, an entity bean represents

    persistent data stored in one row of a database table. If the clientterminates or if the server shuts down, the underlying services ensurethat the entity bean data is saved.A message-driven bean combinesfeatures of a session bean and a Java Message

    Service (JMS) message listener, allowing a business component toreceive JMS messages asynchronously. This tutorial describes entity

    beans and session beans.

    J2EE Containers

  • 7/31/2019 Project Report on Online-Banking

    23/68

    Normally, thin-client multitiered applications are hard to write becausethey involve many lines of intricate code to handle transaction and statemanagement, multithreading, resource pooling, and other complex low-level details. The component-

    based and platform-independent J2EE architecture makes J2EEapplications easy to write because business logic is organized intoreusable components. In addition, the J2EE server provides underlyingservices in the form of a container for every component type. Becauseyou do not have to develop these services yourself, you are free toconcentrate on solving the business problem at hand.

    Container TypesThe deployment process installs J2EE application components in the

    J2EE containers illustrated in Figure 1.5.

    Figure 1.5 J2EE Server and Containers

    J2EE server

    The runtime portion of a J2EE product. A J2EE server provides EJBand Web containers.

    Enterprise JavaBeans (EJB) container

    Manages the execution of enterprise beans for J2EE applications.

    Enterprise beans and their container run on the J2EE server.

    Web container

  • 7/31/2019 Project Report on Online-Banking

    24/68

    Manages the execution of JSP page and servlet componentsfor J2EE applications. Web components and their containerrun on the J2EE server.

    Application client container

    Manages the execution of application client components. Applicationclients and their container run on the client.

    Applet containerManages the execution of applets. Consists of a Web browser and Java

    Plug-in running on the client together.

    Enterprise Bean Developer

    An enterprise bean developer performs the following tasks to deliver anEJB JAR file that contains the enterprise bean: Writes and compiles the source code Specifies the deployment descriptor

    Bundles the .class files and deployment descriptor into an EJB JARfile.

    Web Component Developer

    A Web component developer performs the following tasks to deliver aWAR file containing the Web component: Writes and compiles servlet source code

    Writes JSP and HTML files Specifies the deployment descriptor for the Web component Bundles the .class, .jsp, .html, and deployment descriptor files in theWAR file

    J2EE Application Client Developer

  • 7/31/2019 Project Report on Online-Banking

    25/68

    An application client developer performs the following tasks to delivera JAR file containing the J2EE application client: Writes and compiles the source code Specifies the deployment descriptor for the client Bundles the .class files and deployment descriptor into the JAR file

    Application Assembler

    The application assembler is the company or person who receivesapplication component JAR files from component providers andassembles them into a J2EE application EAR file. The assembler ordeployer can edit the deployment descriptor directly or use tools that

    correctly add XML tags according to interactive selections. A softwaredeveloper performs the following tasks to deliver an EAR filecontaining the J2EE application: Assembles EJB JAR and WAR files created in the previous phasesinto a J2EE application (EAR) file Specifies the deployment descriptor for the J2EE application Verifies that the contents of the EAR file are well formed and complywith the J2EE specification

    Database Access

    The relational database provides persistent storage for application data.A J2EE implementation is not required to support a particular type ofdatabase, which means that the database supported by different J2EE

    products can vary. See the Release Notes included with the J2EE SDKdownload for a list of the databases currently supported by the

    reference implementation.

    J2EE APIs

    The Java 2 Platform, Standard Edition (J2SE) SDK is required to runthe J2EE SDK and provides core APIs for writing J2EE components,core development tools, and the Java virtual machine. The J2EE SDK

    provides the following APIs to be used in J2EE applications.

  • 7/31/2019 Project Report on Online-Banking

    26/68

    Enterprise JavaBeans Technology 2.0

    An enterprise bean is a body of code with fields and methods toimplement modules of business logic. You can think of an enterprise

    bean as a building block that can be used alone or with other enterprisebeans to execute business logic on the J2EE server.There are three kinds of enterprise beans: session beans, entity beans,and message-driven beans. Enterprise beans often interact withdatabases. One of the benefits of entity beans is that you do not have towrite any SQL code or use the JDBC API directly to performdatabase access operations; the EJB container handles this for you.However, if you override the default container-managed persistence for

    any reason, you will need to use the JDBC API.

    JDBC API 2.0

    The JDBC API lets you invoke SQL commands from Javaprogramming language methods. You use the JDBC API in anenterprise bean when you override the default container-managed

    persistence or have a session bean access the database.

    With container-managed persistence, database access operations arehandled by the container, and your enterprise bean implementationcontains no JDBC code or SQL commands. You can also use the JDBCAPI from a servlet or JSP page to access the database directly withoutgoing through an enterprise bean.The JDBC API has two parts: anapplication-level interface used by the applicationcomponents to access a database, and a service provider interface toattach a JDBC driver to the J2EE platform.

    Java Servlet Technology 2.3

    Java Servlet technology lets you define HTTP-specific servlet classes.A servlet class extends the capabilities of servers that host applicationsaccessed by way of a request-response programming model. Althoughservlets can respond to any type of request, they are commonly used toextend the applications hosted by Web servers.

  • 7/31/2019 Project Report on Online-Banking

    27/68

    JavaServer Pages Technology 1.2

    JavaServer Pages technology lets you put snippets of servlet codedirectly into a text-based document. A JSP page is a text-baseddocument that contains two types of text: static template data, whichcan be expressed in any text-based format such as HTML, WML, andXML, and JSP elements, which determine how the page constructsdynamic content.

    Java Message Service 1.0

    The JMS is a messaging standard that allows J2EE application

    components to create, send, receive, and read messages. It enablesdistributed communication that is loosely coupled, reliable, andasynchronous.

    Java Naming and Directory Interface 1.2

    The JNDI provides naming and directory functionality. It providesapplications with methods for performing standard directory

    operations, such as associating attributes with objects and searching forobjects using their attributes. Using JNDI, a J2EE application can storeand retrieve any type of named Java object. Because JNDI isindependent of any specific implementations, applications can useJNDI to access multiple naming and directory services, includingexisting naming and directory services such as LDAP, NDS, DNS, and

    NIS. This allows J2EE applications to coexist with legacy applicationsand systems.

    Java Authentication and Authorization Service 1.0

    The Java Authentication and Authorization Service (JAAS) providesa way for a J2EE application to authenticate and authorize a specificuser or group of users to run it. JAAS is a Java programming languageversion of the standard Pluggable Authentication Module (PAM)framework that extends the Java 2 Platform security architecture to

    support user-based authorization.

  • 7/31/2019 Project Report on Online-Banking

    28/68

    Tools

    The J2EE reference implementation provides an applicationdeployment tool and an array of scripts for assembling, verifying, anddeploying J2EE applications and managing your development and

    production environments. See Appendix B for a discussion of the tools.

    Application Deployment Tool

    The J2EE reference implementation provides an applicationdeployment tool (deploytool) for assembling, verifying, and deployingJ2EE applications. There are two versions: command line and GUI.

    The GUI tool includes wizards for: Packaging, configuring, and deploying J2EE applications Packaging and configuring enterprise beans Packaging and configuring Web components Packaging and configuring application clients Packaging and configuring resource adaptorsIn addition, configuration information can be set for each componentand module type in the tabbed inspector panes.

    Scripts

    Table 11 lists the scripts included with the J2EE referenceimplementation that let you perform operations from the command line.

  • 7/31/2019 Project Report on Online-Banking

    29/68

    Creating the J2EE Application

    The sample application contains three J2EE components: an enterprisebean, a J2EE application client, and a Web component. Before buildingthese components, you will create a new J2EE application calledConverterApp and will store it in an EAR file namedConverterApp.ear.1. In deploytool, select FileNewApplication.2. Click Browse.3. In the file chooser, navigate to

    j2eetutorial/examples/src/ejb/converter.4. In the File Name field, enter ConverterApp.ear.5. Click New Application.6. Click OK.

    Creating the Enterprise Bean

    An enterprise bean is a server-side component that contains the

    business logic of an application. At runtime, the application clientsexecute the business logic by invoking the enterprise beans methods.

  • 7/31/2019 Project Report on Online-Banking

    30/68

    The enterprise bean in our example is a stateless session bean calledConverterEJB. The source code for ConverterEJB is in the

    j2eetutorial/examples/src/ejb/converter directory.

    Coding the Enterprise Bean

    The enterprise bean in this example requires the following code: Remote interface Home interface Enterprise bean class

    Coding the Remote Interface

    A remote interface defines the business methods that a client may call.The business methods are implemented in the enterprise bean code.The source code for the Converter remote interface follows:

    import javax.ejb.EJBObject;import java.rmi.RemoteException;import java.math.*;

    public interface Converter extends EJBObject {public BigDecimal dollarToYen(BigDecimal dollars)throws RemoteException;

    public BigDecimal yenToEuro(BigDecimal yen)throws RemoteException;}

    Coding the Home Interface

    A home interface defines the methods that allow a client to create, find,or remove an enterprise bean. The ConverterHome interface contains asingle create method, which returns an object of the remote interfacetype. Here is the source code for the ConverterHome interface:

    import java.io.Serializable;import java.rmi.RemoteException;

    import javax.ejb.CreateException;

  • 7/31/2019 Project Report on Online-Banking

    31/68

    import javax.ejb.EJBHome;public interface ConverterHome extends EJBHome {Converter create() throws RemoteException, CreateException;}

    Coding the Enterprise Bean Class

    The enterprise bean class for this example is called ConverterBean.This class implements the two business methods, dollarToYen andyenToEuro that the Converter remote interface defines. The sourcecode for the ConverterBean class follows:

    import java.rmi.RemoteException;import javax.ejb.SessionBean;import javax.ejb.SessionContext;import java.math.*;

    public class ConverterBean implements SessionBean {BigDecimal yenRate = new BigDecimal("121.6000");BigDecimal euroRate = new BigDecimal("0.0077");

    public BigDecimal dollarToYen(BigDecimal dollars) {

    BigDecimal result = dollars.multiply(yenRate);return result.setScale(2,BigDecimal.ROUND_UP);}

    public BigDecimal yenToEuro(BigDecimal yen) {BigDecimal result = yen.multiply(euroRate);return result.setScale(2,BigDecimal.ROUND_UP);}

    public ConverterBean() {}

    public void ejbCreate() {}public void ejbRemove() {}public void ejbActivate() {}public void ejbPassivate() {}public void setSessionContext(SessionContext sc) {}}

    Compiling the Source Files

  • 7/31/2019 Project Report on Online-Banking

    32/68

    Now you are ready to compile the remote interface (Converter.java),home interface (ConverterHome.java), and the enterprise bean class(Converter-Bean.java).1. In a terminal window, go to the j2eetutorial/examples directory.2. Type the following command: ant converterThis command compiles the source files for the enterprise bean and theJ2EE application client. It places the resulting class files in the

    j2eetutorial/examples/build/ejb/converter directory (not the srcdirectory).

    Creating the J2EE Application Client

    A J2EE application client is a program written in the Javaprogramming language.At runtime, the client program executes in adifferent virtual machine than the J2EE server.The J2EE applicationclient in this example requires two different JAR files. The first JARfile is for the J2EE component of the client. This JAR file containstheclients deployment descriptor and its class files. When you run the

    New Application Client wizard, the deploytool utility automaticallycreates the JAR file and stores it in the applications EAR file. Defined

    by the J2EE Specification, the JAR file is portable across all compliantJ2EE servers. The second JAR file contains stub classes that arerequired by the client program at runtime. These stub classes enable theclient to access the enterprise beans that are running in the J2EE server.Because this second JAR file is not covered by theJ2EE Specification,it is implementation specific, intended only for the J2EE SDK.TheConverterClient.java source code illustrates the basic tasks performed

    by the client of an enterprise bean:

    Locating the home interface Creating an enterprise bean instance Invoking a business method

    Locating the Home Interface

  • 7/31/2019 Project Report on Online-Banking

    33/68

    The ConverterHome interface defines life-cycle methods such ascreate. Before the ConverterClient can invoke the create method, itmust locate and instantiate an object whose type is ConverterHome.This is a four-step process.

    1. Create an initial naming context.Context initial = new InitialContext();The Context interface is part of the Java Naming and DirectoryInterface (JNDI). A naming context is a set of name-to-object bindings.A name that is bound within a context is theJNDI name of the object.An InitialContext object, which implements the Context interface,

    provides the starting point for the resolution of names. All naming

    operations are relative to a context.

    2. Obtain the environment naming context of the application client.Context myEnv = (Context)initial.lookup("java:comp/env");The java:comp/env name is bound to the environment naming context of theConverterClient component.

    3. Retrieve the object bound to the name ejb/SimpleConverter.

    Object objref = myEnv.lookup("ejb/SimpleConverter");The ejb/SimpleConverter name is bound to an enterprise bean reference, alogical name for the home of an enterprise bean. In this case, the ejb/SimpleConverter name refers to the ConverterHome object. The namesof enterprise beans should reside in the java:com/env/ejb subcontext.

    4. Narrow the reference to a ConverterHome object.ConverterHome home =(ConverterHome)

    PortableRemoteObject.narrow(objref,ConverterHome.class);

    Creating an Enterprise Bean Instance

  • 7/31/2019 Project Report on Online-Banking

    34/68

    To create the bean instance, the client invokes the create method on theConverterHome object. The create method returns an object whose typeis Converter. The remote Converter interface defines the businessmethods of the bean that the client may call. When the client invokesthe create method, the EJB container instantiates the bean and theninvokes the ConverterBean.ejb-Create method. The client invokes thecreate method as follows:

    Converter currencyConverter = home.create();

    Creating the Web Client

    The Web client is contained in the JSP page j2eetutorial/examples/src/ejb/converter/index.jsp. A JSP page is a text-based document thatcontains static template data, which can be expressed in any text-basedformat such as HTML, WML, and XML; and JSP elements, whichconstruct dynamic content.

    Coding the Web Client

    The statements (in bold in the following code) for locating the homeinterface, creating an enterprise bean instance, and invoking a businessmethod are nearly identical to those of the J2EE application client. The

    parameter of the lookup method is the only difference; the motivationfor using a different name is discussed in Specifying the JNDI

    Names .The classes needed by the client are declared with a JSP pagedirective (enclosed within the characters). Because locatingthe home interface and creating the enterprise bean are performed only

    once, this code appears in a JSP declaration (enclosed within the characters) that contains the initialization method, jspInit, of theJSP page. The declaration is followed by standardHTML markup for creating a form with an input field. A scriptlet(enclosed within the characters) retrieves a parameter from therequest and converts it to a BigDecimal object. Finally, JSP expressions(enclosed within characters) invoke the enterprise beans

    business methods and insert the result into the stream of data returned

    to the client.

  • 7/31/2019 Project Report on Online-Banking

    35/68

    ConverterConverter

    Enter an amount to convert :


    0 ) {BigDecimal d = new BigDecimal (amount);

    %>

  • 7/31/2019 Project Report on Online-Banking

    36/68

    dollars are Yen.

    Yen are Euro.

    Compiling the Web Client

    The J2EE server automatically compiles Web clients that are JSPpages. If the Web client were a servlet, you would have to compile it.

    Deploying the J2EE Application

    Now that the J2EE application contains the components, it is ready fordeployment.1. Select the ConverterApp application.

    2. Select ToolsDeploy.3. In the Introduction dialog box, confirm that ConverterApp is shownfor the Object to Deploy and that localhost is shown for the TargetServer.4. Select the checkbox labeled Return Client Jar.5. In the text field that appears, enter the full path name for the fileConverterAppClient.jar so that it will reside in the j2eetutorial/examples/src/ejb/converter subdirectory. The ConverterAppClient.jar

    file contains the stub classes that enable remote access to ConverterEJB.6. Click Next.7. In the JNDI Names dialog box, verify the names you entered in the

    previous section.8. Click Next.9. In the WAR Context Root dialog box, enter converter in the ContextRoot field. When you run theWeb client, the converter context root will

    be part of the URL.

  • 7/31/2019 Project Report on Online-Banking

    37/68

    10. Click Next.11. In the Review dialog box, click Finish.12. In the Deployment Progress dialog box, click OK when thedeployment completes.

    Running the J2EE Application Client

    To run the J2EE application client, perform the following steps:-

    1. In a terminal window, go to the j2eetutorial /examples/src/ejb/converter directory.2. Verify that this directory contains the ConverterApp.ear and

    ConverterAppClient.jar files.3. Set the APPCPATH environment variable to ConverterAppClient.

    jar.4. Type the following command (on a single line):runclient -clientConverterApp.ear -name ConverterClient-textauth5. The client container prompts you to log in. Enter guest for the username and guest123 for the password.6. In the terminal window, the client displays these lines:

    Binding name:java:comp/env/ejb/SimpleConverter 12160.000.77Unbinding name:java:comp/env/ejb/SimpleConverter

  • 7/31/2019 Project Report on Online-Banking

    38/68

    Other Enterprise Bean Features

    The topics that follow apply to both session and entity beans.

    Accessing Environment Entries

    Stored in an enterprise beans deployment descriptor, an environmententry is a name-value pair that allows you to customize the beans

    business logic without changing its source code. An enterprise beanthat calculates discounts, for example, might have an environmententry named Discount Percent. Before deploying the beans

    application, you could run deploytool and assign Discount Percent avalue of .05 on the Env.Entries tab. When you run the application, theenterprise bean fetches the .05 value from its environment.In the following code example, the applyDiscount method usesenvironment entries to calculate a discount based on the purchaseamount. First, the method locates the environment naming context byinvoking lookup with the java:comp/env parameter. Then it callslookup on the environment to get the values for the Discount Level and

    Discount Percent names. For example, if you assign a value of .05 tothe Discount Percent name in deploytool, the code will assign .05 to the

  • 7/31/2019 Project Report on Online-Banking

    39/68

    discountPercent variable. The applyDiscount method, which follows, isin the CheckerBean class.

    public double applyDiscount(double amount) {try {double discount;Context initial = new InitialContext();Context environment =(Context)initial.lookup("java:comp/env");Double discountLevel =(Double)environment.lookup("DiscountLevel");Double discountPercent =(Double)environment.lookup("DiscountPercent");

    if (amount >= discountLevel.doubleValue()) {discount = discountPercent.doubleValue();}else {discount = 0.00;}return amount * (1.00 - discount);} catch (NamingException ex) {

    throw new EJBException("NamingException: "+ex.getMessage());}}

    Entity Bean Class

    The sample entity bean class is called SavingsAccountBean. As youlook through its code, note that it meets the requirements of any entity

    bean with bean-managed persistence. First of all, it implements thefollowing:

    EntityBean interface Zero or more ejbCreate and ejbPostCreate methods Finder methods Business methods Home methods

  • 7/31/2019 Project Report on Online-Banking

    40/68

    In addition, an entity bean class with bean-managed persistence hasthese requirements: The class is defined as public. The class cannot be defined as abstract or final. It contains an empty constructor. It does not implement the finalize method.

    The EntityBean Interface

    The EntityBean interface extends the EnterpriseBean interface, whichextends the Serializable interface. The EntityBean interface declares a

    number of methods, such as ejbActivate and ejbLoad, which you mustimplement in your entity bean class. These methods are discussed inlater sections.

    The ejbCreate Method

    When the client invokes a create method, the EJB container invokes thecorresponding ejbCreate method. Typically, an ejbCreate method in anentity bean performs the following tasks:

    Inserts the entity state into the database Initializes the instance variables Returns the primary keyThe ejbCreate method of SavingsAccountBean inserts the entity stateinto the database by invoking the private insertRow method, whichissues the SQL INSERT statement. Here is the source code for theejbCreate method:

    Public String ejbCreate(String id, String firstName,String lastName,BigDecimal balance)throws CreateException {if (balance.signum() == -1) {throw new CreateException("A negative initial balance is not allowed.");}

    try {

  • 7/31/2019 Project Report on Online-Banking

    41/68

    insertRow(id, firstName, lastName, balance);} catch (Exception ex) {throw new EJBException("ejbCreate: " +ex.getMessage());}this.id = id;this.firstName = firstName;this.lastName = lastName;this.balance = balance;return id;}Although the SavingsAccountBean class has just one ejbCreatemethod, an enterprise bean may contain multiple ejbCreate methods.

    For an example, see the CartEJB.java source code in thej2eetutorial/examples/src/ejb/cart directory.When writing an ejbCreate method for an entity bean, be sure to followthese rules:

    The access control modifier must be public. The return type must be the primary key. The arguments must be legal types for the Java RMI API.

    The method modifier cannot be final or static.The throws clause may include the javax.ejb.CreateException andexceptions that are specific to your application. An ejbCreate methodusually throws a CreateException if an input parameter is invalid. If anejbCreate method cannot create an entity because another entity withthe same primary key already exists, it should throw a javax.ejb.DuplicateKeyException (a subclass of CreateException). If a clientreceives a CreateException or a DuplicateKeyException, it should

    assume that the entity was not created. The state of an entity bean maybe directly inserted into the database by an application that is unknownto the J2EE server. For example, a SQL script might insert a row intothe savingsaccount table. Although the entity bean for this row was notcreated by an ejbCreate method, the bean can be located by a client

    program.

  • 7/31/2019 Project Report on Online-Banking

    42/68

    The ejbPostCreate Method

    For each ejbCreate method, you must write an ejbPostCreate method in

    the entity bean class. The EJB container invokes ejbPostCreateimmediately after it calls ejbCreate. Unlike the ejbCreate method, theejbPostCreate method can invoke the getPrimaryKey and getEJBObject methods of the EntityContext interface. For more informationon the getEJB Object method, see the section passing an EnterpriseBeans Object Reference. Often, your ejbPostCreate methods will beempty. The signature of an ejbPostCreate method must meet thefollowing requirements:

    The number and types of arguments must match a correspondingejbCreate method. The access control modifier must be public. The method modifier cannot be final or static. The return type must be void.The throws clause may include the javax.ejb.CreateException andexceptions that are specific to your application.

    The ejbRemove Method

    A client deletes an entity bean by invoking the remove method. Thisinvocation causes the EJB container to call the ejbRemove method,which deletes the entity state from the database. In the Savings AccountBeanclass, the ejbRemove method invokes a private method nameddeleteRow, which issues a SQL DELETE statement. The ejbRemove

    method is short:public void ejbRemove() {try {deleteRow(id);catch (Exception ex) {throw new EJBException("ejbRemove: " +ex.getMessage());}}

    If the ejbRemove method encounters a system problem, it should throwthe javax.ejb.EJBException. If it encounters an application error, it

  • 7/31/2019 Project Report on Online-Banking

    43/68

    should throw a javax.ejb.RemoveException. For a comparison ofsystem and application exceptions, see the section HandlingExceptions.An entity bean may also be removed directly by a database deletion.For example, if a SQL script deletes a row that contains an entity beanstate, then that entity bean is removed.

    The ejbLoad and ejbStore Methods

    If the EJB container needs to synchronize the instance variables of anentity bean with the corresponding values stored in a database, itinvokes the ejbLoad and ejbStore methods. The ejbLoad method

    refreshes the instance variables from the database, and the ejbStoremethod writes the variables to the database. The client may not callejbLoad and ejbStore.

    If a business method is associated with a transaction, thecontainer invokes ejb-Load before the business method executes.Immediately after the business method executes, the container callsejbStore. Because the container invokes ejbLoad and ejbStore, you donot have to refresh and store the instance variables in your business

    methods. The SavingsAccountBean class relies on the container tosynchronize the instance variables with the database. Therefore, the

    business methods of SavingsAccountBean should be associated withtransactions.

    If the ejbLoad and ejbStore methods cannot locate an entity inthe underlying database, they should throw the javax.ejb.NoSuch EntityException. This exception is a subclass of EJBException. BecauseEJBException is a subclass of RuntimeException, you do not have to

    include it in the throws clause. When NoSuchEntityException isthrown, the EJB container wraps it in a RemoteException beforereturning it to the client. In the SavingsAccountBean class, ejbLoadinvokes the loadRow method, which issues a SQL SELECT statementand assigns the retrieved data to the instance variables. The ejbStoremethod calls the storeRow method, which stores the instance variablesin the database with a SQL UPDATE statement. Here is the codefor theejbLoad and ejbStore methods:

  • 7/31/2019 Project Report on Online-Banking

    44/68

    public void ejbLoad() {try {loadRow();} catch (Exception ex) {throw new EJBException("ejbLoad: " +ex.getMessage());}}

    public void ejbStore() {try {storeRow();} catch (Exception ex) {throw new EJBException("ejbStore: " +ex.getMessage());

    }}

    The Finder Methods

    The finder methods allow clients to locate entity beans. TheSavingsAccount-Client program locates entity beans with three findermethods:

    SavingsAccount jones = home.findByPrimaryKey("836");...Collection c = home.findByLastName("Smith");...Collection c = home.findInRange(20.00, 99.00);For every finder method available to a client, the entity bean class mustimplement a corresponding method that begins with the prefix ejbFind.

    The SavingsAccountBean class, for example, implements theejbFindBy LastName method as follows:

    public Collection ejbFindByLastName(String lastName)throws FinderException {Collection result;try {result = selectByLastName(lastName);

    } catch (Exception ex) {

  • 7/31/2019 Project Report on Online-Banking

    45/68

    throw new EJBException("ejbFindByLastName " +ex.getMessage());}return result;}The finder methods that are specific to your application, such asejbFindBy- LastName and ejbFindInRange, are optionalbut theejbFindByPrimaryKey method is required. As its name implies, theejbFindByPrimaryKey method accepts as an argument the primary key,which it uses to locate an entity bean. In the SavingsAccount Beanclass, the primary key is the id variable. Here is the code for theejbFindByPrimaryKey method:

    public String ejbFindByPrimaryKey(String primaryKey)throws FinderException {

    boolean result;try {result = selectByPrimaryKey(primaryKey);} catch (Exception ex) {throw new EJBException("ejbFindByPrimaryKey: " +ex.getMessage());

    }if (result) {return primaryKey;}else {throw new ObjectNotFoundException("Row for id " + primaryKey + " not found.");}

    }The ejbFindByPrimaryKey method may look strange to you, because ituses a primary key for both the method argument and return value.However, remember that the client does not call ejbFindByPrimaryKey directly. It is the EJB container that calls the ejbFindByPrimaryKey method. The client invokes the findByPrimaryKey method, whichis defined in the home interface.The following list summarizes the rules for the finder methods that you

    implement in an entity bean class with bean-managed persistence:

  • 7/31/2019 Project Report on Online-Banking

    46/68

    The ejbFindByPrimaryKey method must be implemented. A finder method name must start with the prefix ejbFind. The access control modifier must be public. The method modifier cannot be final or static. The arguments and return type must be legal types for the Java RMIAPI.(This requirement applies only to methods defined in a remotenot localhome interface.) The return type must be the primary key or a collection of primarykeys. The throws clause may include the javax.ejb.FinderException andexceptions that are specific to your application. If a finder methodreturns a single primary key and the requested entity does not exist, themethod should throw the javax.ejb.ObjectNotFoundException (a

    subclass of FinderException). If a finder method returns a collection ofprimary keys and it does not find any objects, it should return an emptycollection.

    The Business Methods

    The business methods contain the business logic that you want toencapsulate within the entity bean. Usually, the business methods do

    not access the database, allowing you to separate the business logicfrom the database access code. The SavingsAccountBean class containsthe following business methods:

    public void debit(BigDecimal amount)throws InsufficientBalanceException {if (balance.compareTo(amount) == -1) {throw new InsufficientBalanceException();

    }balance = balance.subtract(amount);}

    public void credit(BigDecimal amount) {balance = balance.add(amount);}

    public String getFirstName() {return firstName;

    }

  • 7/31/2019 Project Report on Online-Banking

    47/68

    public String getLastName() {return lastName;}

    public BigDecimal getBalance() {return balance;}The SavingsAccountClient program invokes the business methods asfollows:BigDecimal zeroAmount = new BigDecimal("0.00");SavingsAccount duke = home.create("123", "Duke", "Earl",ZeroAmount);...

    duke.credit(new BigDecimal("88.50"));duke.debit(new BigDecimal("20.25"));BigDecimal balance = duke.getBalance();

    The requirements for the signature of a business method are the samefor both session and entity beans:

    The method name must not conflict with a method name defined by

    the EJB architecture. For example, you cannot call a business methodejb-Create or ejbActivate. The access control modifier must be public. The method modifier cannot be final or static. The arguments and return types must be legal types for the Java RMIAPI.This requirement applies only to methods defined in a remotenotlocalhome interface.The throws clause may include the exceptions

    that you define for your application.The debit method, for example,throws the Insufficient Balance Exception.To indicate a system-level problem, a business method should throwthe javax.ejb.EJBException.

    The Home Methods

    A home method contains the business logic that applies to all entity

    beans of a particular class. In contrast, the logic in a business method

  • 7/31/2019 Project Report on Online-Banking

    48/68

  • 7/31/2019 Project Report on Online-Banking

    49/68

    The home interface defines a corresponding method namedchargeForLowBalance. Since the interface provides the client view, theSavingsAccountClient program invokes the home method asfollows:

    SavingsAccountHome home;...home.chargeForLowBalance(new BigDecimal("10.00"),new BigDecimal("1.00"));In the entity bean class, the implementationof a home method must adhere to these rules:

    A home method name must start with the prefix ejbHome.

    The access control modifier must be public. The method modifier cannot be static.The throws clause may include exceptions that are specific to yourapplication; it must not throw the java.rmi.RemoteException.

    Home Interface

    The home interface defines the methods that allow a client to create and

    find an entity bean. The SavingsAccountHome interface follows:

    import java.util.Collection;import java.math.BigDecimal;import java.rmi.RemoteException;import javax.ejb.*;

    public interface SavingsAccountHome extends EJBHome {public SavingsAccount create(String id, String firstName,

    String lastName, BigDecimal balance)throws RemoteException, CreateException;

    public SavingsAccount findByPrimaryKey(String id)throws FinderException, RemoteException;

    public Collection findByLastName(String lastName)

    Remote Interface

  • 7/31/2019 Project Report on Online-Banking

    50/68

    The remote interface extends javax.ejb.EJBObject and defines thebusiness methods that a remote client may invoke. Here is theSavingsAccount remote interface:

    import javax.ejb.EJBObject;import java.rmi.RemoteException;import java.math.BigDecimal;

    public interface SavingsAccount extends EJBObject {public void debit(BigDecimal amount)throws InsufficientBalanceException, RemoteException;

    public void credit(BigDecimal amount)throws RemoteException;

    public String getFirstName()throws RemoteException;

    public String getLastName()throws RemoteException;

    public BigDecimal getBalance()throws RemoteException;}

    Handling Exceptions

    The exceptions thrown by enterprise beans fall into two categories:system and application. A system exception indicates a problem withthe services that support an application. Examples of these problemsinclude the following: a database connection cannot be obtained; a SQLinsert fails because the database is full, or a lookup method cannot findthe desired object. If your enterprise bean encounters a system- level

    problem, it should throw a javax.ejb.EJBException. The container willwrap the EJBException in a RemoteException, which it passes back tothe client. Because the EJBException is a subclass of theRuntimeException, you do not have to specify it in the throws clause ofthe method declaration. If a system exception is thrown, the EJBcontainer might destroy the bean instance. Therefore, a systemexception cannot be handled by the beans client program; it requiresintervention by a system administrator. An application exception

    signals an error in the business logic of an enterprise bean. There aretwo types of application exceptions: customized and predefined. A

  • 7/31/2019 Project Report on Online-Banking

    51/68

    customized exception is one that youve coded yourself, such as theInsufficentBalanceException thrown by the debit business method ofthe SavingsAccountEJB example. The javax.ejb package includesseveral predefined exceptions that are designed to handle common

    problems. For example, an ejb-Create method should throw aCreateException to indicate an invalid input parameter. When anenterprise bean throws an application exception, the containerdoes not wrap it in another exception. The client should be able tohandle any application exception it receives. If a system exceptionoccurs within a transaction, the EJB container rolls back thetransaction. However, if an application exception is thrown within atransaction, the container does not roll back the transaction.

    Method Name Exception It Throws Reason for

    Throwing-ejbCreate -CreateException An input parameter is invalid.- ejbFindByPrimaryKey(and other finder methods that return a singleobject)ObjectNotFoundException (subclass of FinderException)The database row for the requested entity bean cannot be found.

    -ejbRemove-RemoveExceptionThe entity beans row cannot be deletedfrom the database.-ejbLoad-NoSuchEntityException.The database row to be loadedcannot be found.-ejbStore-NoSuchEntityException.The database row to be updatedcannot be found. (All methods) EJBException A system problem has

    been encountered.

    Entity Bean ClassFor container-managed persistence, the code of the entity bean classmust meet the syntax requirements. First, the class must be defined as

    public and abstract. Also, the class must implement the following:

    The EntityBean interface Zero or more ejbCreate and ejbPostCreate methods

    The get and set access methods, defined as abstract, for the persistentand relationship fields

  • 7/31/2019 Project Report on Online-Banking

    52/68

  • 7/31/2019 Project Report on Online-Banking

    53/68

    Since message-driven beans are based on the Java Message Service(JMS) technology, to understand the example in this chapter youshould already be familiar with basic JMS concepts such as queues andmessages.This chapter describes the source code of a simple message-driven beanexample. Before proceeding, you should read the basic conceptualinformation in the section What Is a Message-Driven Bean?

    The Message-Driven Bean Class

    The code for the SimpleMessageEJB class illustrates the requirementsof a message-driven bean class:

    It implements the MessageDrivenBean and MessageListenerinterfaces. The class is defined as public. The class cannot be defined as abstract or final. It implements one onMessage method. It implements one ejbCreate method and one ejbRemove method. It contains a public constructor with no arguments.

    It must not define the finalize method.Unlike session and entity beans, message-driven beans do not have theremote orlocal interfaces that define client access. Client componentsdo not locate message-driven beans and invoke methods on them.Although message-driven beansdo not have business methods, theymay contain helper methods that are invoked internally by theonMessage method.

    The onMessage Method

    When the queue receives a message, the EJB container invokes theonMessagemethod of the message-driven bean. In the SimpleMessageBean class, theonMessage method casts the incoming message to aTextMessage and displaysthe text:

    public void onMessage(Message inMessage) {TextMessage msg = null;

    try {if (inMessage instanceof TextMessage) {

  • 7/31/2019 Project Report on Online-Banking

    54/68

  • 7/31/2019 Project Report on Online-Banking

    55/68

  • 7/31/2019 Project Report on Online-Banking

    56/68

  • 7/31/2019 Project Report on Online-Banking

    57/68

    access it. This is a security feature to avoid entry ofunauthorized users.

    Employee login:

    It includes logins for those employees who workthere inside the bank. It is only for NFB(National Film Board)employees. This page is made in JSP.

  • 7/31/2019 Project Report on Online-Banking

    58/68

    Home Page:

    This page is displayed when a new customer firstlogins into his/her account. It contains links for otheroperations such as transaction, searching etc.

  • 7/31/2019 Project Report on Online-Banking

    59/68

  • 7/31/2019 Project Report on Online-Banking

    60/68

    Transaction Form:

    This page helps us to store the current and previous

    transactions done in his/her account and the medium oftransaction.

  • 7/31/2019 Project Report on Online-Banking

    61/68

    View statement:

    This form is used by the bank employees for searchingthe account details of the customers in their databases.The searching for account details can be done in two ways:-

    By account id

  • 7/31/2019 Project Report on Online-Banking

    62/68

  • 7/31/2019 Project Report on Online-Banking

    63/68

    Administrator Page:

    This page is used for deleting all the information of arespective customer who has closed his account from the bankby using his/her account-id.

    Update Page:

  • 7/31/2019 Project Report on Online-Banking

    64/68

    This page is used for updating or modifying anyinformation regarding personal or account details of acustomer by using his/her registration-id.

    E-R Diagram

    USER_NAME

    PASSWORD

    DATA

    TYPE

    NOTNU

    LLPRIMA

    RY

  • 7/31/2019 Project Report on Online-Banking

    65/68

  • 7/31/2019 Project Report on Online-Banking

    66/68

    Better retrieval of records. Customer Record Maintenance.

    Multiple criteria based reporting. Transaction Entry

    Balance update and retrieval.

    Unit Master Entry and Item Master entry.

    Taking security into consideration, the customer account hadto be password protected. I had two options, an encrypted

    password hidden in the registry or a file stored on disk (mostsecure but slower) or using a password hidden in the tagproperty in a control (less secure but faster and easier tocode).I chose the latter as the former would be unnecessary,bulky in coding and it would take far too long to develop aneffective algorithm for ciphering and deciphering.

    CONCLUSION

    The conclusion of this report is that after reading you will beable to make and run web application programs in Java andcreate other real world applications by paying much more

    attention to Java programming. One can also understand and

  • 7/31/2019 Project Report on Online-Banking

    67/68

    familiar with various J2EE technology which includesServlets, JSP, EJB (Enterprise Java Beans) etc.

    Java can be used as the front-end for preparing any project.These java applications are needed to employ fullfunctionality of the project. The reporting is done throughvarious parameters passed from the form. In this applicationthere is transaction entry and customer record system.

    This application is useful for person who needs money

    transaction in day to day working. Now he will find it easierbecause this is a combine application with all requiredutilities. Error handling has been done in this project.

    Bibliography

    NIIT Study material

    Sun Microsystems-Student Guide

    The Complete Reference(J2EE)

  • 7/31/2019 Project Report on Online-Banking

    68/68