KEMBAR78
J2EE Introduction | PDF
Building web
            applications with
            J2EE
            Papapetrou P. Patroklos

            Software Engineer / Team Leader at
            OTS SA ( www.ots.gr ) since 1997
            Part-time lecturer at City College (MSc)
            Opensource projects contributor

            ppapapetrou76@gmail.com
            http://twitter.com/ppapapetrou76

Computer Science Department
Overview



    J2EE Introduction

    J2EE Technologies

    J2EE Servers

    A working example

    Q&A Session


           Computer Science Department
J2EE Introduction


    What does J2EE stand for?

    What is its purpose?

 Why should I learn to develop Web
Applications using J2EE technologies?

    Pros / Cons

    Differences with other possible solutions

    Required skills

             Computer Science Department
A glance at J2EE
      architecture




Computer Science Department
A glance at J2EE
               architecture

  End-to-End Architecture

  N-tier Layers

  Components: handle
   – Business Logic
   – Presentation
   – Persistence

  Containers
   – Vendor-specfic Implementations
   – Strictly follow same rules
         Computer Science Department
A glance at J2EE
                  architecture

 Containers -> work invisible. Provide
services for :
    – Security
    – Transaction
    – Persistence
    – Concurrency
    – Availability
    – Life-cycle Management

            Computer Science Department
J2EE Development
                  Lifecycle

    Develop components for
     – Persistence (Entities)
     – Business Logic (EJBs)
     – Presentation (JSF, XHTML)

    Configure/Prepare deployment descriptors

 Build Compoments in packages (JARs, WARs,
EARs)

    Deploy packages on Container (J2EE Server)

            Computer Science Department
J2EE Development
                   life-cycle - Tools

 All target to facilitate building
documentation and management of (Java)
projects

    Plethora of choices
     – Maven : stands for Accumulator of
       Knowledge
     – Ant
     – Ivy
     – Gradle
             Computer Science Department
J2EE Technologies


    Java Persistence API (JPA)

    Enterprise Java Beans (EJB)

    eXtended Markup Language (XML)

    Java Server Faces (JSF)

    Java API for XML RPC (JAX-RPC)

 eXtensible HyperText Markup Language
(XHTML)

    Service Oriented Architecture (SOA)

            Computer Science Department
Other Related
                   Technologies

    Cascading Style Sheets (CSS)

    JavaScript & Jquery

    Ajax

    Dependency Injection Frameworks
     – Google Guice
     – Spring Source
     – Jboss Weld

    ... coming more...
             Computer Science Department
EJB Overview


    What is EJB?
    
        A platform for building portable, reusable,
        and scalable business applications using
        Java
    
        a piece of Java code that executes in a
        specialized runtime environment called the
        EJB container
    
        EJB is both a component and a framework


               Computer Science Department
EJB Overview (cont'd)


    EJB as a component
    
      Persistence
      
        Entity Beans
    
      Business Logic
      
        Session Beans
      
        Message-Driven Beans




            Computer Science Department
EJB Overview (cont'd)
EJB as a framework
 
   Out-of-the-box services
 
   Available to all components during
   execution via EJB Container
 
   Annotations : The magic wand
   
     Specify services, types and behavior
 
   Service Oriented Architecture
   
     Fast and easy Web Service Creation




         Computer Science Department
JSF Overview

What is Java Server Faces
 
     A component architecture
 
     A standard – extendable set of UI Widgets
 
     An application infastructure
Basic Characteristics
 
     Event oriented components
 
     Powerful architectures for different Uis
     (desktop browsers, mobile devices etc.)
 
     Flexible Navigation System
            Computer Science Department
JSF Overview (cont'd)

Basic Characteristics
 
     Syncronization with Java Objects through
     backing beans
 
     Internationaliztion
 
     Validators & Converters
 
     Several popular implementations
        • RichFaces
        • IceFaces
        • PrimeFaces
            Computer Science Department
XHTML Overview

Why XHTML instead of HTML?
 
     A more clean and standard way to write
     HTML
 
     Take advantages of all XML goodies
 
     Allows a larger percentage of browsers or
     code parsers to properly parse pages
 
     Use of Templates to facilitate page
     reusability and “inheritance”


            Computer Science Department
XHTML Overview

Differences with HTML
 
     XHTML elements must be properly nested
 
     XHTML elements must always be closed
 
     XHTML elements must be in lowercase
 
     XHTML documents must have one root
     element
 
     Documents can be validated much easier



           Computer Science Department
XHTML Overview

Differences with HTML
 
     Documents can be transformed via tools
     like XSLT into other documents for
     consumption by devices like handhelds
 
     Fragments of documents can be retrieved
     faster
 
     Text can be stored more effieciently in
     object oriented databases


            Computer Science Department
J2EE Servers

Servers supporting J2EE
 
     Oracle/Sun's Glassfish (
     http://glassfish.java.net)
 
     Apache's Jeronimo (
     http://geronimo.apache.org)
 
     RedHat's Jboss (http://www.jboss.org )
 
     IBM's Webshpere
 
     Oracle's WebLogic
 
     Caucho's Resin (http://www.caucho.com)
             Computer Science Department
J2EE Servers

not for EJBs...
 
     Tomcat
 
     Jetty
not for J2EE...
 
     IIS
 
     Apache HTTP
Can you figure out why??



             Computer Science Department
A working example

MyBlog Application
 
     MySQL as database layer
 
     Entities for persistence layer
 
     Session Beans for business logic layer
 
     XHTML pages for presentation layer
        • JSF2 Framework
        • Extended by PrimeFaces



            Computer Science Department
Q&A Session



        Thank you


Time for answers!!



Computer Science Department

J2EE Introduction

  • 1.
    Building web applications with J2EE Papapetrou P. Patroklos Software Engineer / Team Leader at OTS SA ( www.ots.gr ) since 1997 Part-time lecturer at City College (MSc) Opensource projects contributor ppapapetrou76@gmail.com http://twitter.com/ppapapetrou76 Computer Science Department
  • 2.
    Overview  J2EE Introduction  J2EE Technologies  J2EE Servers  A working example  Q&A Session Computer Science Department
  • 3.
    J2EE Introduction  What does J2EE stand for?  What is its purpose?  Why should I learn to develop Web Applications using J2EE technologies?  Pros / Cons  Differences with other possible solutions  Required skills Computer Science Department
  • 4.
    A glance atJ2EE architecture Computer Science Department
  • 5.
    A glance atJ2EE architecture  End-to-End Architecture  N-tier Layers  Components: handle – Business Logic – Presentation – Persistence  Containers – Vendor-specfic Implementations – Strictly follow same rules Computer Science Department
  • 6.
    A glance atJ2EE architecture  Containers -> work invisible. Provide services for : – Security – Transaction – Persistence – Concurrency – Availability – Life-cycle Management Computer Science Department
  • 7.
    J2EE Development Lifecycle  Develop components for – Persistence (Entities) – Business Logic (EJBs) – Presentation (JSF, XHTML)  Configure/Prepare deployment descriptors  Build Compoments in packages (JARs, WARs, EARs)  Deploy packages on Container (J2EE Server) Computer Science Department
  • 8.
    J2EE Development life-cycle - Tools  All target to facilitate building documentation and management of (Java) projects  Plethora of choices – Maven : stands for Accumulator of Knowledge – Ant – Ivy – Gradle Computer Science Department
  • 9.
    J2EE Technologies  Java Persistence API (JPA)  Enterprise Java Beans (EJB)  eXtended Markup Language (XML)  Java Server Faces (JSF)  Java API for XML RPC (JAX-RPC)  eXtensible HyperText Markup Language (XHTML)  Service Oriented Architecture (SOA) Computer Science Department
  • 10.
    Other Related Technologies  Cascading Style Sheets (CSS)  JavaScript & Jquery  Ajax  Dependency Injection Frameworks – Google Guice – Spring Source – Jboss Weld  ... coming more... Computer Science Department
  • 11.
    EJB Overview  What is EJB?  A platform for building portable, reusable, and scalable business applications using Java  a piece of Java code that executes in a specialized runtime environment called the EJB container  EJB is both a component and a framework Computer Science Department
  • 12.
    EJB Overview (cont'd)  EJB as a component  Persistence  Entity Beans  Business Logic  Session Beans  Message-Driven Beans Computer Science Department
  • 13.
    EJB Overview (cont'd) EJBas a framework  Out-of-the-box services  Available to all components during execution via EJB Container  Annotations : The magic wand  Specify services, types and behavior  Service Oriented Architecture  Fast and easy Web Service Creation Computer Science Department
  • 14.
    JSF Overview What isJava Server Faces  A component architecture  A standard – extendable set of UI Widgets  An application infastructure Basic Characteristics  Event oriented components  Powerful architectures for different Uis (desktop browsers, mobile devices etc.)  Flexible Navigation System Computer Science Department
  • 15.
    JSF Overview (cont'd) BasicCharacteristics  Syncronization with Java Objects through backing beans  Internationaliztion  Validators & Converters  Several popular implementations • RichFaces • IceFaces • PrimeFaces Computer Science Department
  • 16.
    XHTML Overview Why XHTMLinstead of HTML?  A more clean and standard way to write HTML  Take advantages of all XML goodies  Allows a larger percentage of browsers or code parsers to properly parse pages  Use of Templates to facilitate page reusability and “inheritance” Computer Science Department
  • 17.
    XHTML Overview Differences withHTML  XHTML elements must be properly nested  XHTML elements must always be closed  XHTML elements must be in lowercase  XHTML documents must have one root element  Documents can be validated much easier Computer Science Department
  • 18.
    XHTML Overview Differences withHTML  Documents can be transformed via tools like XSLT into other documents for consumption by devices like handhelds  Fragments of documents can be retrieved faster  Text can be stored more effieciently in object oriented databases Computer Science Department
  • 19.
    J2EE Servers Servers supportingJ2EE  Oracle/Sun's Glassfish ( http://glassfish.java.net)  Apache's Jeronimo ( http://geronimo.apache.org)  RedHat's Jboss (http://www.jboss.org )  IBM's Webshpere  Oracle's WebLogic  Caucho's Resin (http://www.caucho.com) Computer Science Department
  • 20.
    J2EE Servers not forEJBs...  Tomcat  Jetty not for J2EE...  IIS  Apache HTTP Can you figure out why?? Computer Science Department
  • 21.
    A working example MyBlogApplication  MySQL as database layer  Entities for persistence layer  Session Beans for business logic layer  XHTML pages for presentation layer • JSF2 Framework • Extended by PrimeFaces Computer Science Department
  • 22.
    Q&A Session Thank you Time for answers!! Computer Science Department