• Loading
    • J2EE Overview

      Course Objective

      •The Objective of J2EE course are:
      –To understand multi-tiered enterprise applications.

      –To understand J2EE framework for developing enterprise applications.

      –To understand various components of J2EE like JSP, Servlets, and effectively use them.

      –To understand Application Server and its configurations.

      –To learn and deploy web based applications in application server.



      What is WWW

      •The WWW incorporates all of the Internet services above and much more.

      •You can retrieve documents, view images, animation, and video, listen to sound files, speak and hear voice, and view programs that run on practically any software in the world, provided your computer has the hardware and software to do these things.



      How does WWW work


      HTTP
      •HTTP defines the requests that a client can send to a server and responses that the server can send in reply ]

      •Each request contains a URL, which is a string that identifies a Web component or a static object such as an HTML page or image file.



      •HTTP – Hyper Text Transfer Protocol
      •URL – Uniform Resource Locator
      •HTML – Hyper Text Markup Language



      HTTP Communication


      HTTP Commands

      GET - retrieves the resource identified by the request URL.
      HEAD - returns the headers identified by the request URL.
      POST - sends data of unlimited length to the Web server.
      PUT - stores a resource under the request URL.
      DELETE - removes the resource identified by the request URL.
      OPTIONS - returns the HTTP methods the server supports.
      TRACE - returns the header fields sent with the TRACE request.



      HTTP Request

      •An HTTP request is sent by the browser to server. It will have the command, the requested object, protocol, and any additional attribute passed along with the object.



      HTTP Response
      •An HTTP message sent by a server to a client is called an HTTP response. The initial line of an HTTP response is called the status line.
      •It has three parts, separated by spaces: the HTTP version, a response status code that tells the result of the request, and an English phrase describing the status code.
      Code:
      HTTP/1.0 200 OK 
      Date: Tue, 01 Dec 2001 23:59:59 GMT 
      Content-Type: text/html 
      Content-Length: 52 
      <html> 
      <body> 
      <h1>Hello, John!</h1> 
      </body> 
      </html>
      Web Application

      •An obvious but still accurate definition of a web application is that it is an application that is accessible from the web!

      •Normally, web server serves static content only.

      •To build a web application, we write small programs on the server.

      •When the user requests for this script, it is executed on the server and the output (which is a HTML file) is sent to the client.




      J2EE
      •Java 2 Platform, Enterprise Edition (J2EE) defines the standard for developing component-based multi-tier distributed enterprise applications.

      •A J2EE component is a self-contained functional software unit that is assembled into a J2EE application along with related components.

      •An enterprise-level platform for developing portable, secure, scalable, distributed, multi-tier business applications.

      •Application logic is divided into components according to function

      •The various application components that make up a J2EE application are installed on different machines depending on the tier in the multitiered J2EE environment to which the application component belongs



      J2EE Multi-tier Framework


      •Business logic is in EJB (Enterprise Java Bean) container and can be accessed either by a web client (browser) or any other client. These clients include swing based GUI applications, other applications developed in other platform and programming languages, applications running on PDAs (Personal Digital Assistant) and mobile phones etc.

      •EIS – Enterprise Information Systems (legacy systems).

      •Container is a logical concept which holds components.

      •Client is a software sitting on the desktop interacting with server through network using some protocol.



      J2EE Architecture


      Applets : An applet is a small client application written in the Java programming language that executes in the Java virtual machine installed in the Web browser. client systems will likely need the Java Plug-in and possibly a security policy file in order for the applet to successfully execute in the Web browser.

      Application clients: Swing bases rich GUI. Either can access data tier directly or through HTTP socket connection.

      Web clients:
      •A web client consists of two parts:
      •Dynamic Web pages containing various types of markup language (HTML, XML, and so on), which are generated by Web components running in the Web tier, and
      •A Web browser, which renders the pages received from the server.

      •A Web client is sometimes called a thin client. Thin clients usually do not query databases, execute complex business rules, or connect to legacy applications. When you use a thin client, such heavyweight operations are off-loaded to enterprise beans executing on the J2EE server, where they can leverage the security, speed, services, and reliability of J2EE server-side technologies.
      •Web tier consists of servlets and JSP pages. It is also called presentation layer/logic/tier.

      •Enterprise Java Beans capture the business logic. They are kept in EJB containers.

      •Apart from these, J2EE provides some common services like, messaging, mail, lookup etc.

      •Various devices can interact with application in XML (Extensible Markup Language), HTML and WML (Wireless Markup Language) format



      J2EE offerings for Developer


      •Enterprise Java Beans is used to capture business logic.

      •Servlets and JSP provides a mechanism to communicate between clients (browsers) and servers.

      •JDBC is the middle tier used to talk to underlying database.

      •Naming service is used to lookup various components dynamically during runtime.

      •Authentication and authorization service is used to provide role based access to various users.

      •Messaging service is used form inter-component communication.

      •Transaction is used to ensure that atomicity is maintained for each transaction.



      J2EE Application Components


      –J2EE applications comprises various components.
      •Client Components
      –Built using applets which runs on client machine
      •Web Compoents
      –Built using Java Servlet technology and JSP technology which runs on server.
      •Business Compnents
      –Built using EJB technolgy which runs on server.


      Components are self contained software modules which can be used for plug-and-play kind of software development. If want to change one functionality, the current component can be replaced by another component without affecting the whole application.
      Web Components
      •J2EE Web components can be either servlets or JSP pages
      Servlets are Java programming language classes that dynamically process requests and construct responses.
      JSP pages are text-based documents that execute as servlets but allow a more natural approach to creating static content



      •Static HTML pages and applets are bundled with Web components during application assembly, but are not considered Web components by the J2EE specification.
      •Server-side utility classes can also be bundled with Web components and, like HTML pages, are not considered Web components.




      Web Tier



      Business Components

      •Business code, which is logic that solves or meets the needs of a particular business domain such as banking, retail, or finance, is handled by enterprise beans running in the business tier.





      Business Tier


      EIS Tier
      •The enterprise information system tier handles enterprise information system software and includes enterprise infrastructure systems such as enterprise resource planning (ERP), mainframe transaction processing, database systems, and other legacy information systems.

      •Related API’s
      – JCA , JDBC , JMS , Web Services etc



      J2EE Containers

      •What is a Container
      Containers are the interface between a component and the low-level platform specific functionality that supports the component.
      •How does it work
      –Container settings are specified for each component during assembly process before deployment.
      •What do I get
      –Support for security, transaction management, JNDI lookup, Remote connectivity.



      Here are some of the highlights:

      •The J2EE security model lets you configure a Web component or enterprise bean so that system resources are accessed only by authorized users.
      •The J2EE transaction model lets you specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a single unit.
      •JNDI lookup services provide a unified interface to multiple naming and directory services in the enterprise so that application components can access naming and directory services.
      •The J2EE remote connectivity model manages low-level communications between clients and enterprise beans. After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual machine.




      –Manage life cycle of objects
      –Manage transactions
      –Provide security
      –Resource optimization
      •DB pooling
      •Compiled JSP Caching
      –Persistence support
      •CMP (EJB-QL)



      Here are some of the highlights:

      •The J2EE security model lets you configure a Web component or enterprise bean so that system resources are accessed only by authorized users.

      •The J2EE transaction model lets you specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a single unit.

      •JNDI lookup services provide a unified interface to multiple naming and directory services in the enterprise so that application components can access naming and directory services.

      •The J2EE remote connectivity model manages low-level communications between clients and enterprise beans. After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual machine.

      •CMP – Container Managed Persistence
      •EJB–QL – Enterprise Java Bean Query Language (similar to SQL).



      J2EE Roles & Responsibilities

      •J2EE Product Provider
      –Builds Compliant products
      • IBM Websphere
      •JBoss
      •Application Component Provider
      –Develops the application – jsp, servlet, ejb etc.
      •Application Assembler
      –Resolves dependencies, Deliver deployable app.


      •Deployer
      –Configures resources
      •DB, Roles, Users, etc.
      •System Administrator / Production Support
      –Runtime monitoring, Network administration, Support
      •Tool Provider
      –Provides helper tools for managing, deploying, developing, packaging.



      Reference
      •Stephanie Bodoff, et. al., The J2EE Tutorial, Sun Microsystems.
      •James Mc Govern, et. al., J2EE 1.4. Bible.



    Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.