Designing an enterprise application using SPRING,JSF,EJB3

Source: Internet
Author: User
Tags jboss jboss application server

Overview

The core framework of Java EE 5.0 is the EJB (Enterprise JavaBeans) 3.0 and JSF (javaserverfaces) 1.2. EJB 3.0 is a component model of server-side business services and database persistence based on POJO (Plain old Java Objects). JSF is a WEB application framework based on MVC (Model-view-controller). Most applications will contain EJB3 components with business logic and JSF components for the front-end display of WEB applications. On the surface, EJB3 and JSF complement each other, but they are independent frameworks designed according to their ideas, neither of which can solve all the computational problems alone. For example, EJB3 uses annotations (annotation) to configure the service, and JSF uses an XML file. EJB3 and JSF components are not sensitive at the framework level and are best used in combination. But the Java EE 5 specification does not provide a standard way to consolidate the two component models. To consolidate EJB3 and JSF, developers must manually link business components (EJBS) to WEB components (JSF) so that methods can be invoked across frames.

Spring, as a lightweight container, is often considered an alternative to EJB, and for many applications, spring as a container, with its support for transactions and ORM, is another option than using an EJB container to achieve the same functionality. But it's not like using Spring to use EJBS. In fact, Spring makes it easier to access and implement EJBS. Spring provides a way to integrate JSF and EJB, respectively. This article will use Eclipse to develop an example to illustrate this process.

Example Introduction

The example of this article realizes the basic operation of the Product information deletion, modification and checking. Only one domain model was used: Product, and the following is its UML diagram:

Figure 1. Product class Diagram

Build a development environment

The development platform of this article uses the Windows Vista operating system, so the following environment settings are the needle WindowsVista operating system.

Download the latest JDK from the Java site and install it into any directory. In this paper, the jdk1.6.0_01 is used.

Download eclipse for Java EE developers 3.4 or later from the Eclipse site and extract it to any directory. In this paper, the eclipse3.4.1 is used.

Download JBoss Application Server 4.2 or later from the JBoss site and extract to any directory. In this paper, the Jboss-4.2.2.ga is used.

Download the Spring Framework 2.5 or later from the spring site and extract it to any directory. In this paper, the spring-framework-2.5.4 is used.

Create an EAR application Project

Set JRE, which is required when JBoss is running. Turn on Windows > Preferences > Java > Installed JREs to make sure that the Locaton of the selected JRE is the installation directory for JDK. The JDK installation directory for this article is C:\soft\Java\jdk1.6.0_01.

Figure 2. Setting up JDK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.