外文翻译---JSP技术与主流JAVA EE开源框架(SSH)技术简介

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

本科毕业设计外文翻译
JSP technology and mainstream open-source framework for JAVA EE
院(系、部)名称:工商管理学院
专业名称:信息管理与信息系统
学生姓名:
学生学号:
指导教师:
JSP technology and mainstream open-source framework for
JA V AEE
1.JSP Profile
JSP (Java Server Pages) is initiated by Sun Microsystems, Inc., with many
companies to participate in the establishment of a dynamic web page technical standards. JSP technology somewhat similar to ASP technology, it is in the traditional HTML web page document (*.htm, *. html) to insert the Java programming paragraph (Scriptlet) and JSP tag (tag), thus JSP documents (*.jsp). Using JSP development of the Web application is cross-platform that can run on Linux, is also available for other operating systems.
JSP technology to use the Java programming language prepared by the category of XML tags and scriptlets, to produce dynamic pages package processing logic. Page also visit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page design and display separation, support reusable component-based design, Web-based application development is rapid and easy.
Web server in the face of visits JSP page request, the first implementation of the procedures of, and then together with the results of the implementation of JSP documents in HTML code with the return to the customer. Insert the Java programming operation of the database can be re-oriented websites, in order to achieve the establishment of dynamic pages needed to function.JSP and Java Servlet, is in the implementation of the server, usually returned to the client is an HTML text, as long as the client browser will be able to visit.
JSP 1.0 specification of the final version is launched in September 1999, December has introduced 1.1 specifications. At present relatively new is JSP1.2 norms, JSP2.0 norms of the draft has also been introduced.
JSP pages from HTML code and Java code embedded in one of the components. The server was in the pages of client requests after the Java code and then will generate the HTML pages to return to the client browser. Java Servlet JSP is the technical foundation and large-scale Web application development needs of Java Servlet and JSP support to complete. JSP with the Java technology easy to use, fully object-oriented, and a platform-independent and secure mainly for all the characteristics of the Internet. JSP technology strength: (1) time to prepare, run everywhere. At this point Java better than PHP, in addition to systems, the code not to make any changes.(2) the multi-platform support. Basically on all platforms of any development environment, in any environment for deployment in any environment in the expansion. Compared ASP / PHP limitations are obvious. (3) a strong scalability. From only a small Jar documents can run Servlet / JSP, to the multiple servers clustering and load balancing, to multiple Application for transaction processing,
information processing, a server to numerous servers, Java shows a tremendous Vitality. (4) diver sification and powerful development tools support. This is similar to the ASP, Java already have many very good development tools, and many can be free, and many of them have been able to run on a variety of platforms under. JSP technology vulnerable:(1) and the same ASP, Java is the advantage of some of its fatal problem. It is precisely because in order to cross-platform functionality, in order to extreme stretching capacity, greatly increasing the complexity of the product. (2) Java's speed is class to complete the permanent memory, so in some cases by the use of memory compared to the number of users is indeed a "minimum cost performance." On the other hand, it also needs disk space to store a series of. Java documents and. Class, as well as the corresponding versions of documents.
2. J2EE Development Framework
Java2 Enterprise Edition middleware unified ideology played a significant role. For example, J2EE for distributed transaction management, directory services and messaging services provide a standard programming interface. J2EE-based -Java2Standard Edition (J2SE), successfully access for Java provides a standard relational database.
But, as this article "J2EE programming of the lack of support", as mentioned, J2EEplatform does not provide a satisfactory application programming model. Sun and some of the major application server vendors wanted to use the development tools to reduce the complexity of J2EE development, but these tools are no other outstanding JA V A development tools, which have advanced refactoring tools, and. NET platform compared, J2EE tool support appeared to be very inferior.
Many J2EE development tools automatically generate the code for the same complex as the tools themselves. In many small-scale J2EE open source community developers chose another way of development - some can be difficult to reduce the development of J2EE development framework, the more popular such as: Struts, Hibernate, and Spring Framework, J2EE project types in many of today they play an important the role.
2.1 Spring Framework
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 book Expert 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.
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.
Modules The Spring Framework comprises several modules that provide a range of services:
Inversion of Control container: configuration of application components and lifecycle management of Java objects
Aspect-oriented programming: enables implementation of cross-cutting routines Data access: working with relational database management systems on the Java platform using JDBC and object-relational mapping tools
Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects
Model-view-controller: an HTTP and Servlet-based framework providing hooks for extension and customization
Remote Access framework: configurative RPC-style export and import of Java objects over networks supporting RMI, CORBA and HTTP-based protocols including web services (SOAP)
Convention-over-configuration: a rapid application development solution for Spring-based enterprise applications is offered in the Spring model.
Batch processing: a framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management
Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project
(formerly Acegi Security System for Spring).
Remote Management: configurative exposure and management of Java objects for local or remote configuration via JMX
Messaging: configurative registration of message listener objects for transparent message consumption from message queues via JMS, improvement of message sending over standard JMS APIs
Testing: support classes for writing unit tests and integration tests
Inversion of Control container Central to the Spring Framework is its Inversion of Control container, which provides a consistent means of configuring and managing Java objects using callbacks. The container is responsible for managing object lifecycles: creating objects, calling initialization methods, and configuring objects by wiring them together.
Objects created by the container are also called Managed Objects or Beans. Typically, the container is configured by loading XML files containing Bean definitions which provide the information required to create the beans.
Objects can be obtained by means of Dependency lookup or Dependency injection. Dependency lookup is a pattern where a caller asks the container object for an object with a specific name or of a specific type. Dependency injection is a pattern where the container passes objects by name to other objects, via either constructors, properties, or factory methods.
In many cases it's not necessary to use the container when using other parts of the Spring Framework, although using it will likely make an application easier to configure and customize. The Spring container provides a consistent mechanism to configure applications and integrates with almost all Java environments, from small-scale applications to large enterprise applications.
The container can be turned into a partially-compliant EJB3 container by means of the Pitchfork project. The Spring Framework is criticized by some as not being standards compliant. However, Spring Source doesn't see EJB3 compliance as a major goal, and claims that the Spring Framework and the container allow for more powerful programming models.
Aspect-oriented programming framework 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 SAOP framework also takes full advantage of the Spring Container.
The Spring AOP framework is interception based, and is configured at runtime. This removes the need for a compilation step or load-time weaving. On the other hand, interception only allows for public or protected method execution on existing objects at a join point.
Compared to the AspectJ framework, Spring AOP is less powerful but also less complicated. Spring 1.2 includes support to configure AspectJ aspects in the container. Spring 2.0 added more integration with AspectJ; for example, the pointcut language is reused and can be mixed with SpAOP-based aspects. Further, Spring 2.0 added a Spring Aspects library which uses AspectJ to offer common Spring features such as declarative transaction management and dependency injection via AspectJ compile-time or load-time weaving. Spring Source also uses AspectJ for AOP in other Spring projects such as Spring Roo and Spring Insight, with Spring Security also offering an AspectJ-based aspect library.
Spring AOP has been designed to make it able to work with cross-cutting concerns inside the Spring Framework. Any object which is created and configured by the container can be enriched using Spring AOP.
The Spring Framework uses Spring AOP internally for transaction management, security, remote access, and JMX.
Since version 2.0 of the framework, Spring provides two approaches to the AOP configuration:schema-based approach.@AspectJ-based annotation style.
The Spring team decided not to introduce new AOP-related terminology; therefore, in the Spring reference documentation and API, terms such as aspect, join point, advice, pointcut, introduction, target object (advised object), AOP proxy, and weaving all have the same meanings as in most other AOP frameworks (particularly AspectJ).
Data access framework Spring's data access framework addresses common difficulties developers face when working with databases in applications. Support is provided for all popular data access frameworks in Java: JDBC, iBatis, Hibernate, JDO, JPA, Oracle Top Link, Apache OJB, and Apache Cayenne, among others.
For all of these supported frameworks, Spring provides these features:
Resource management -automatically acquiring and releasing database resources
Exception handling -translating data access related exception to a Spring data access hierarchy
Transaction participation - transparent participation in ongoing transactions
Resource unwrapping -retrieving database objects from connection pool wrappers
Abstraction for BLOB and CLOB handling
All these features become available when using Template classes provided by Spring for each supported framework. Critics say these Template classes are intrusive and offer no advantage over using (for example) the Hibernate API.. directly. In response, the Spring developers have made it possible to use the Hibernate and JPA APIs directly. This however requires transparent transaction management, as application code no longer assumes the responsibility to obtain and close database resources, and does not support exception translation.
Together with Spring's transaction management, its data access framework offers a flexible abstraction for working with data access frameworks. The Spring Framework doesn't offer a common data access API; instead, the full power of the supported APIs is kept intact. The Spring Framework is the only framework available in Java which offers managed data access environments outside of an application server or container. While using Spring for transaction management with Hibernate, the following beans may have to be configured.
Transaction management framework Spring's transaction management framework brings an abstraction mechanism to the Java platform. Its abstraction is capable of working with local and global transactions (local transaction does not require an application server).working with nested transactions working with transaction safe points working in almost all environments of the Java platform In comparison, JTA only supports nested transactions and global transactions, and requires an application server (and in some cases also deployment of applications in an application server).
The Spring Framework ships a Platform Transaction Manager for a number of transaction management strategies:
Transactions managed on a JDBC Connection
Transactions managed on Object-relational mapping Units of Work
Transactions managed via the JTA Transaction Manager and User Transaction
Transactions managed on other resources, like object databases
Next to this abstraction mechanism the framework also provides two ways of adding transaction management to applications:
Programmatically, by using Spring's Transaction Template
Configuratively, by using metadata like XML or Java 5 annotations
Together with Spring's data access framework — which integrates the transaction management framework — it is possible to set up a transactional system through configuration without having to rely on JTA or EJB. The transactional framework also integrates with messaging and caching engines.
The BoneCP Spring/Hibernate page contains a full example project of Spring used in conjunction with Hibernate.
Model-view-controller framework The Spring Framework features its own MVC framework, which wasn't originally planned. The Spring developers decided to write their own web framework as a reaction to what they perceived as the poor design of the popular Jakarta Struts web framework, as well as deficiencies in other available frameworks. In particular, they felt there was insufficient separation between the presentation and request handling layers, and between the request handling layer and the model.
Like Struts, Spring MVC is a request-based framework. The framework defines strategy interfaces for all of the responsibilities which must be handled by a modern request-based framework. The goal of each interface is to be simple and clear so that it's easy for Spring MVC users to write their own implementations if they so choose. MVC paves the way for cleaner front end code. All interfaces are tightly coupled to the Servlet API. This tight coupling to the Servlet API is seen by some as a failure on the part of the Spring developers to offer a high-level abstraction for web-based applications [citation needed]. However, this coupling makes sure that the features of the Servlet API remain available to developers while offering a high abstraction framework to ease working with said API.
The Dispatcher Servlet class is the front controller of the framework and is responsible for delegating control to the various interfaces during the execution phases of a HTTP request.
The most important interfaces defined by Spring MVC, and their responsibilities, are listed below:
Handler Mapping: selecting objects which handle incoming requests (handlers) based on any attribute or condition internal or external to those requests
Handler Adapter: execution of objects which handle incoming requests
Controller: comes between Model and View to manage incoming requests and redirect to proper response. It essentially is like a gate that directs the incoming information. It switches between going into model or view.
View: responsible for returning a response to the client. It is possible to go straight to view without going to the model part. It is also possible to go through all three.
View Resolver: selecting a View based on a logical name for the view (use is not strictly required)
Handler Interceptor: interception of incoming requests comparable but not equal to Servlet filters (use is optional and not controlled by Dispatcher Servlet).
Locale Resolver: resolving and optionally saving of the locale of an individual user
Multipart Resolver: facilitate working with file uploads by wrapping incoming requests
Each strategy interface above has an important responsibility in the overall framework. The abstractions offered by these interfaces are powerful, so to allow for a set of variations in their implementations, Spring MVC ships with implementations of all these interfaces and together offers a feature set on top of the Servlet API. However, developers and vendors are free to write other implementations. Spring MVC uses the Java java.util.Map interface as a data-oriented abstraction for the Model where keys are expected to be string values.
The ease of testing the implementations of these interfaces seems one important advantage of the high level of abstraction offered by Spring MVC. Dispatcher Servlet is tightly coupled to the Spring Inversion of Control container for configuring the web layers of applications. However, applications can use other parts of the Spring Framework—including the container—and choose not to use Spring MVC.
Because Spring MVC uses the Spring container for configuration and assembly, web-based applications can take full advantage of the Inversion of Control features offered by the container. This framework allows for multi layering. It allows for the code to be broken apart and used more effectively in segments, while allowing the mvc to do the work. It allows for back and forth transmission of data. Some designs are more linear without allowing a forward and backward flow of information. MVC is designed very nicely to allow this interaction. It is used more than just in web
design, but also in computer programming. It's very effective for web design. Basically allows a checks and balance system to occur where before being viewed it can be properly examined.
Remote access framework Spring's Remote Access framework is an abstraction for working with various RPC-based technologies available on the Java platform both for client connectivity and exporting objects on servers. The most important feature offered by this framework is to ease configuration and usage of these technologies as much as possible by combining Inversion of Control and AOP.
The framework also provides fault-recovery (automatic reconnection after connection failure) and some optimizations for client-side use of EJB remote stateless session beans.
Convention-Over-Configuration Rapid Application Development Spring Roo is Spring's Convention-over-configuration solution for rapidly building applications in Java. It currently supports Spring Framework, Spring Security and Spring Web Flow, with remaining Spring projects scheduled to be added in due course. Roo differs from other rapid application development frameworks by focusing on:
The following diagram represents the Spring Framework Architecture
2.2 Struts Introduction
Apache Struts From Wikipedia, the free encyclopedia Jump to: navigation, search
"Struts" redirects here. For the structural component, see strut. For other meanings, see strut (disambiguation).
This article includes a list of references, but its sources remain unclear because it has insufficient inline citations.
Please help to improve this article by introducing more precise citations where appropriate.
Apache Struts is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model-view-controller (MVC) architecture. It was originally created by Craig McClanahan and donated to the Apache Foundation in May, 2000. Formerly located under the Apache Jakarta Project and known as Jakarta Struts, it became a top level Apache project in 2005.
Design goals and over view in a standard Java EE web application, the client will
typically submit information to the server via a web form. The information is then either handed over to a Java Servlet that processes it, interacts with a database and produces an HTML-formatted response, or it is given to a Java Server Pages (JSP) document that inter mingles HTML and Java code to achieve the same result. Both approaches are often considered inadequate for large projects because they mix application logic with presentation and make maintenance difficult.
The goal of Struts is to separate the model (application logic that interacts with a database) from the view (HTML pages presented to the client) and the controller (instance that passes information between view and model). Struts provides the controller (a servlet known as ActionServlet) and facilitates the writing of templates for the view or presentation layer (typically in JSP, but XML/XSLT and Velocity are also supported). The web application programmer is responsible for writing the model code, and for creating a central configuration file struts-config.xml that binds together model, view and controller.
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.
Struts is categorized as a request-based web application framework Struts also supports internationalization by web forms, and includes a template mechanism called "Tiles" that (for instance) allows the presentation layer to be composed from independent header, footer, and content components History The Apache Struts Project was launched in May 2000 by Craig R. McClanahan to provide a standard MVC framework to the Java community. In July 2001, version 1.0 was released.
Struts2 was originally known as WebWork 2. After having been developed separately for several years, WebWork and Struts were combined in 2008 to create Struts 2.
Competing MVC frameworks Although Struts is a well-documented, mature, and popular framework for building front ends to Java applications, there are other frameworks categorized as "lightweight" MVC frameworks such as Spring MVC,
Stripes, Wicket, Play!, and Tapestry. The new XForms standards and frameworks may also be another option to building complex web Form validations with Struts in the future.
The WebWork framework spun off from Apache Struts aiming to offer enhancements and refinements while retaining the same general architecture of the original Struts framework. However, it was announced in December 2005 that Struts would re-merge with WebWork. WebWork 2.2 has been adopted as Apache Struts2, which reached its first full release in February 2007.
In 2004 Sun launched an addition to the Java platform, called Java Server Faces (JSF). Aside from the original Struts framework, the Apache project previously offered a JSF-based framework called Shale, which was retired in May 2009.
In this section we will discuss about Architecture. Struts is famous for its robust Architecture and it is being used for developing small and big software projects.
Struts is an open source framework used for developing J2EE web applications using Model View Controller (MVC) design pattern. It uses and extends the Java Servlet API to encourage developers to adopt an MVC architecture. Struts framework provides three key components:
A request handler provided by the application developer that is used to mapped to a particular URI. A response handler which is used to transfer the control to another resource which will be responsible for completing the response.
A tag library which helps developers to create the interactive form based applications with server pages Learn Struts 2.2.1 framework Struts provides you the basic infrastructure infra structure for implementing MVC allowing the developers to concentrate on the business logic The main aim of the MVC architecture is to separate the business logic and application data from the presentation data to the user.
Here are the reasons why we should use the MVC design pattern They are resuable: When the problems recurs, there is no need to invent a new solution, we just have to follow the pattern and adapt it as necessary. They are expressive: By using the MVC design pattern our application becomes more expressive.
1). Model: The model object knows about all the data that need to be displayed. It is model who is aware about all the operations that can be applied to transform that object. It only represents the data of an application. The model represents enterprise data and the business rules that govern access to and updates of this data. Model is not aware about the presentation data and how that data will be displayed to the browser.
2). View: The view represents the presentation of the application. The view object refers to the model. It uses the query methods of the model to obtain the contents and renders it. The view is not dependent on the application logic. It remains same if there is any modification in the business logic. In other words, we can say that it is the responsibility of the view's to maintain the consistency in its presentation when the model changes.
3). Controller: Whenever the user sends a request for something then it always go through the controller. The controller is responsible for intercepting the requests from view and passes it to the model for the appropriate action. After the action has been taken on the data, the controller is responsible for directing the appropriate view to the user. In GUIs, the views and the controllers often work very closely together.
The Struts framework is composed of approximately 300 classes and interfaces which are organized in about 12 top level packages. Along with the utility and helper classes framework also provides the classes and interfaces for working with controller and presentation by the help of the custom tag libraries. It is entirely on to us which model we want to choose. The view of the Struts architecture is given below: The Struts Controller Components Whenever a user request for something, then the request is handled by the Struts Action Servlet. When the ActionServlet receives the request, it intercepts the URL and based on the Struts Configuration files, it gives the handling of the request to the Action class. Action class is a part of the controller and is responsible for communicating with the model layer.
The Struts View Components: The view components are responsible for presenting information to the users and accepting the input from them. They are responsible for displaying the information provided by the model components. Mostly we use the Java Server Pages (JSP) for the view presentation. To extend the capability of the view we can use the Custom tags, java script etc.
The Struts model component The model components provides a model of the business logic behind a Struts program. It provides interfaces to databases or back-ends systems. Model components are generally a java class. There is not any such defined format for a Model component, so it is possible for us to reuse Java code which are written for other projects. We should choose the model according to our client requirement.
2.3 Hibernate FrameWork。

相关文档
最新文档