Building Web Applications With J2EE

Embed Size (px)

Citation preview

  • 8/2/2019 Building Web Applications With J2EE

    1/29

    Building Web ApplicationsWith J2EE

    OhioedgeEnterprise Java Solutions Provider

    Since 1996

    By Sandeep Dixit, Partner

  • 8/2/2019 Building Web Applications With J2EE

    2/29

    Assumptions

    Audience Background

    Elementary knowledge of J2EE

    Currently planning or in the process ofbuilding Web applications with J2EE

  • 8/2/2019 Building Web Applications With J2EE

    3/29

    Assumptions

    Audience Expectations

    Want to learn or verify essential concepts

    of Web application development withJ2EE

    Want to see live demonstrations of sample applications

    deploying sample applications in J2EE-compliantapplication server

    how a proper implementation of these concepts results inrobustness, quality, and improved productivity

  • 8/2/2019 Building Web Applications With J2EE

    4/29

    Todays Agenda

    Origin of J2EE

    Mindset for building Web applications

    Generalization: J2EE Patterns Three-tier component: EJB-JavaBean-JSP

    XML schema-driven applications

    Directory structure: Effective organization of java,

    jsp, xml, sql and bat script files Package structure: Effective grouping of Java and

    JSP source code

    Live Demonstration of J2eeBuilder Framework &component plug-in

  • 8/2/2019 Building Web Applications With J2EE

    5/29

    J2EE Facts

    J2EE is not a programming language.

    J2EE is a specification for writing enterpriseapplications (distributed computing)

    J2EE specification compliant code is

    portable between J2EE-compliantapplication servers.

  • 8/2/2019 Building Web Applications With J2EE

    6/29

    1985-1992

    One programming language for building

    distributed (client-server) applications IDE for compilation, debugging,

    execution and file management

    Procedural programming

  • 8/2/2019 Building Web Applications With J2EE

    7/29

    1990+

    VB brings client-server (distributed)

    application development environment todesktops

    Procedural programming

    GUI development is more user-friendly

  • 8/2/2019 Building Web Applications With J2EE

    8/29

    1995+

    Java, an OS independent, pure Object-

    oriented, programming language startsgaining ground

    Object-oriented programming is more

    user friendly Java Remote Method Invocation (RMI) is

    made available for distributed computing

  • 8/2/2019 Building Web Applications With J2EE

    9/29

    1997+

    Apache Web Server becomes de-facto

    web server Java RMI is further strengthened by a

    specification - J2EE specification - on

    how to write an RMI server. Developing distributed applications is

    made more user friendly.

  • 8/2/2019 Building Web Applications With J2EE

    10/29

    1999+

    Servlet/JSP makes HTML-based Web GUI

    a real thing for enterprise applications Object-oriented programming is further

    extended into XML definition driven

    object-oriented programming J2EE incorporates XML as the way to

    specify data

  • 8/2/2019 Building Web Applications With J2EE

    11/29

    2000+

    Enthusiastic software developers start

    using J2EE. Container Managed Persistence becomes

    a reality

    Methodologies for writing J2EEapplications are discovered.

  • 8/2/2019 Building Web Applications With J2EE

    12/29

    2001+

    Various articles, papers, and books on

    J2EE Patterns, Practices, and Strategiesare published and presented

    Jboss an open-source J2EE 1.3-compliant

    application server is used by more than 1Million developers world-wide

    J2EE is free. J2EE is open. J2EE is here

    to stay.

  • 8/2/2019 Building Web Applications With J2EE

    13/29

    Mindset for building Web

    applications

    Think in terms of Servicing a request

    For example, a click on a create buttonon a customer page in a browser is arequest.

    Building a Web application requires anapproach of handling and processing httprequests and sending appropriate

    responses back to the requesters

    Application

    Server

    CRM

  • 8/2/2019 Building Web Applications With J2EE

    14/29

    Generalization of Services

    Generalization of how http requests are

    serviced by presentation-tier, middle-tier,and data-tier results in a generic, inter-tier dependent, reusable library of sourcecode - J2EE patterns

  • 8/2/2019 Building Web Applications With J2EE

    15/29

    Generalization of Services

    For an example, the application processing customer-createrequest needs to verify if the requester is valid, requesters session isvalid, and license to use application itself is valid. These validation

    steps are independent of customer-create request and areapplicable to any requests such as, customer-delete, contact-find,etc.

    This requires that every time a request is received it should be firstpassed-on to a generic validation service that would either permit

    or deny further servicing of the request.

    Typically, validation service would get categorized underpresentation services. Depending upon the layer where theservices are called, they would be categorized under either -presentation, business, or data services.

  • 8/2/2019 Building Web Applications With J2EE

    16/29

    Servicing a request

    Http request originates in a browser

    Http response ends in the browser

    URL

    Presentation-tier

    Business-tier

  • 8/2/2019 Building Web Applications With J2EE

    17/29

    J2EE Patterns: Presentation-tier

    Front Controller

    View Helper

    Composite View

    Service To Worker

    Dispatcher View

  • 8/2/2019 Building Web Applications With J2EE

    18/29

    Brief overview of

    Presentation-tier patterns Front Controller: Provides a centralized controller for

    managing the handling of a request

    View Helper: Encapsulates logic that is not related topresentation formatting into Helper components

    TheViewController

    *.ctrl

  • 8/2/2019 Building Web Applications With J2EE

    19/29

    Brief overview of

    Presentation-tier patterns Dispatcher View: Similar to Service To Worker; Dispatcher plays a limited role

    in the processing of requests - Dispatcher plays limited to moderate role inview management.

    Limited role: No outside resources are utilized in order to choose the view. The informationencapsulated in the request is sufficient to determine the view to dispatch the request. Forexample: http://my.server.com/myContextRoot/Controller?next=login.jsp

    Moderate role: The information contains an action to be completed:http://my.server.com/myContextRoot/Controller?action=login The responsibility of thedispatcher component here is to translate the logical name login into the resource name of anappropriate view, such as login.jsp, and dispatch to that view. To accomplish this translation, thedispatcher may access resources such as an XML configuration file that specifies the appropriate

    view to display.

    Service To Worker: Combines a Dispatcher component with the FrontController and View Helper patterns - Dispatcher plays moderate to largerole in view management. Dispatcher is more sophisticated. The dispatchermay invoke a business service to determine the appropriate view to display. For example: http://my.server.com/myContextRoot/Customer.ctrl?submit=Set

  • 8/2/2019 Building Web Applications With J2EE

    20/29

    Service To Worker

    URL

    Business-tier

  • 8/2/2019 Building Web Applications With J2EE

    21/29

    Processing the request

    URL

    Service

    Locator

    Value

    Object

    Requests EJB/BusinessService

    Locates

    Business

    Service

    EJBBusiness

    Delegate

  • 8/2/2019 Building Web Applications With J2EE

    22/29

    J2EE Patterns: Business-tier

    Business Delegate

    Value Object

    Session Faade

    Composite Entity

    Value Object Assembler

    Value List Handler

    Service Locator

  • 8/2/2019 Building Web Applications With J2EE

    23/29

    Brief overview of Business-tier

    patterns Business Delegate: De-couples presentation and service tiers,

    and provides a faade and proxy interface to the services.

    Value Object: Facilitates data exchange between EJB andBusinessDelegate

    Value List Handler: Manages query execution, results caching,and results processing.

    Service Locator: Encapsulates complexity of business servicelookup and creation; locates business service factories.

  • 8/2/2019 Building Web Applications With J2EE

    24/29

    J2EE Patterns for Servicing

    Requests Front Controller

    View Helper

    Composite View

    Service To Worker

    Dispatcher View

    Business Delegate

    Value Object

    Session Faade

    Composite Entity

    Value Object Assembler

    Value List Handler

    Service Locator

    Service Activator

    Data Access Object

    Business-tierPresentation-tier Data-tier

  • 8/2/2019 Building Web Applications With J2EE

    25/29

    Directory Structure

    Source Code

    Scripts

    J2EE Specification Code ejb.xml web.xml application.xml

    J2EE Application Specific Code jboss.xml

    jboss-web.xml Java/Jar Specific Code

    manifest.mf

  • 8/2/2019 Building Web Applications With J2EE

    26/29

    Package Structure

    Business Functionality code

    extends framework code

    Framework code

    implementation of patterns

  • 8/2/2019 Building Web Applications With J2EE

    27/29

    J2eeBuilder Framework

    Demonstration of a framework

    Implementation of patterns

    Session Management

    User Management

    License Management

    j2eebuilder-config.xml

    Demonstration of plugging-in a product componentinto the framework

  • 8/2/2019 Building Web Applications With J2EE

    28/29

    Summary

    J2EE is Java, EJB specification, Servlet, JSP, Html, and XML

    Use open-source software such JDOM, LOG4J, Apache Web Server,

    Tomcat Servlet Container, and JBoss Application Server Document your architecture, data-structure, functional scope,

    directory structure, and package structure, before launching a full-scale development

    Understand key concepts. Learn to do-it by hand using simple

    TextPad before using IDEs.

    Keep it J2EE compliant. Avoid getting locked into any vendor specifictechnology.

    You build a generic framework and robustness, quality andproductivity will come.

  • 8/2/2019 Building Web Applications With J2EE

    29/29

    Q & A