C410W11 Struts Report
C410W11 Struts Report
Ronghong Li
You Li
Paul Filipow
Miao Xu
Chao Rui
1.Introduction
1.1.2 Advantages
1.2 JavaBean
JavaBeans are reusable software components for Java that can be manipulated
visually in a builder tool.
1.2.1 Introduction
Practically, they are classes written in the Java programming language
conforming to a particular convention. They are used to encapsulate many objects
into a single object (the bean), so that they can be passed around as a single bean
object instead of as multiple individual objects. A JavaBean is a Java Object that is
serializable, has a nullary constructor, and allows access to properties using getter and
setter methods.
2. Spring
2.1 Introduction
The Spring Framework is an open source application framework for the Java
platform.
The first version was written by Rod Johnson who released the framework
with the publication of his bookExpert One-on-One J2EE Design and Development
in October 2002. The framework was first released under the Apache 2.0 license in
June 2003. The first milestone release, 1.0, was released in March 2004, with further
milestone releases in September 2004 and March 2005. The Spring 1.2.6 framework
won a Jolt productivity award and a JAX Innovation Award in 2006. Spring 2.0 was
released in October 2006, and Spring 2.5 in November 2007. In December 2009
version 3.0 GA was released. The current version is 3.0.5.[4]
The core features of the Spring Framework can be used by any Java application,
but there are extensions for building web applications on top of the Java EE platform.
Although the Spring Framework does not impose any specific programming model, it
has become popular in the Java community as an alternative to, replacement for, or
even addition to the Enterprise JavaBean (EJB) model.
2.2 Basic Goal
Basically Spring Framework helps us manage the relationships between different
parts of the project (bean management) to loosen the coupling between them with
modules that will be mentioned after. Loose coupling will make the whole project easy
to test, easy to change and easy to management.
2.3 Modules
Spring use dependency injection to achieve IoC which means that we don’t have
to deal with the dependency in the code. We only need to define the interface and set
the detail in Spring’s configure file, Spring will inject the dependency (like create the
instance we need) during the runtime.
A good example: http://www.vaannila.com/spring/spring-ioc-1.html
The Spring Framework has its own AOP framework which modularizes cross-
cutting concerns in aspects. The motivation for creating a separate AOP framework
comes from the belief that it would be possible to provide basic AOP features without
too much complexity in either design, implementation, or configuration. The SpAOP
framework also takes full advantage of the Spring Container.
3. Struts
As shown in the graph, Java Servlets are designed to handle requests made by
Web browsers. Java ServerPages are designed to create dynamic Web pages that can
turn billboard sites into live applications. Struts uses a special Servlet as a switchboard
to route requests from Web browsers to the appropriate ServerPage. This makes Web
applications much easier to design, create, and maintain.
In general, requests from the client are sent to the controller in the form
of "Actions" defined in the configuration file; if the controller receives such a request it
calls the corresponding Action class that interacts with the application-specific model
code. The model code returns an "ActionForward", a string telling the controller what
output page to send to the client. Information is passed between model and view in the
form of special JavaBeans. A powerful custom tag library allows it to read and write the
content of these beans from the presentation layer without the need for any embedded
Java code.
4. Hibernate
4.1 Introduction
Hibernate is an object-relational mapping (ORM) library for the Java language,
providing a framework for mapping an object-oriented domain model to a traditional
relational database. It allows application developers high-level access to database
technology by introducing a level of abstraction between Java objects and relational
database tables.
4.2 Benefits
Hibernate offers a number of benefits to application developers. It provides for
full object-oriented programming even when saving/retrieving data from database, and
completely removes the developer’s need for SQL and database queries, and relational
table construction.
In addition to accelerating development time, the abstraction Hibernate provides
also creates a higher level of data independence than does the traditional SQL/
relational model. By removing database structure and queries from the developer,
applications and databases can change independently of each other, without any
refactoring on either end.