重头开始学 Spring JPetStore 1

先看看它的 readme.txt

引用
@author Juergen Hoeller
Based on Clinton Begin's JPetStore (http://www.ibatis.com).

1. MOTIVATION
Features a Spring-managed middle tier with iBATIS Database Layer as data access
strategy, in combination with Spring's transaction and DAO abstractions.

Can work with local JDBC transactions or JTA, with the latter on two databases.
Uses the same data model and demo contents as the original JPetStore.
See the context definitions "WEB-INF/dataAccessContext-local.xml" respectively
"WEB-INF/dataAccessContext-jta.xml" for details.

Offers two alternative web tier implementations with the same user interface:
one based on Spring's web MVC, and one based on Struts 1.1. The latter is close
to the original JPetStore but reworked for JSTL, to make the JSP implementations
as comparable as possible. See "WEB-INF/web.xml", "WEB-INF/petstore-servlet.xml",
and "WEB-INF/struts-config.xml" for details.

Compared to the original JPetStore, this implementation is significantly
improved in terms of internal structure and loose coupling: Leveraging Spring's
application context concept, there's a central place for wiring application
objects now. The most notable improvement is the former PetStoreLogic, now
called PetStoreFacade: It is no longer concerned with configuration, resource,
or transaction details.
Note that the Spring-based web tier implementation is deliberately similar to
the Struts-based one and does not aim to improve in terms of in-place error
messages or the like. The inclusion of two web tier alternatives outlines the
differences as well as the similarities in the respective programming model,
and also illustrates the different configuration styles.
This version of JPetStore also demonstrates various remoting options with Spring:
Hessian, Burlap, RMI, and Web Services via Apache Axis. They are all provided
out-of-the-box by the default web application (note that RMI is commented out
to avoid conflicts with EJB containers). The "client" directory contains a simple
command-line client that invokes the exported OrderService via all protocols.


动机

演示一个基于spring中间层 数据库层访问策略为ibatis 并组合spring事务及DAO抽象的情景。
能结合JDBC事务或者JTA工作(与后面的两个数据库的情景中。)

使用了与原始JPetStore相似的数据模型和演示内容。具体上下文定义查看2个配置文件。

为相似的用户接口提供了两种web层实现,一个是基于springmvc的实现。一个是基于struts1.1的实现,后面一个接近原始的JPetStore,但是用JSTL标签重写了,以便JSP实现更具有可比性。了解细节查看3个配置文件。

和原始的JPetStore相比较,这个实现显著的提高了内部结构和松耦合:利用Spring的应用程序上下文原则,这里现在是建立对象之间联系的中心了。最值得注意的改进是从前的PetStoreLogic,现在称为PetStoreFacade,它不再关注配置资源和事务细节。

注意基于spring的web层实现故意与基于struts的实现很像并且没有关注改进适当位置的错误消息提示等等。这展示了2个web层的不同和相同点,同时还展示了不同的配置风格。

这个版本的JPetStore 也展示了Spring支持的多种远程调用方法:Hessian, Burlap, RMI, and Web Services via Apache Axis.他们都被用于提供web程序外部调用(注意 RMI 调用被注释掉了来以防与EJB容器冲突)。client目录包含了简单的命令行客户端以各种协议 调用暴露出来的OrderService 方法。

你可能感兴趣的:(spring,xml,Web,ibatis,struts)