JPetStore5配置代码分析
l Web.xml
配置了struts文件
Session时间
定义首页文件
对jsp文件的保护
l struts-config.xml
Struts配置文件
l Dao.xml
从DaoConfig.java里引入,构造出DaoManager。内容如下:
<daoConfig>
<context>
<transactionManager type="SQLMAP">
<property name="SqlMapConfigResource"
value="com/ibatis/jpetstore/persistence/sqlmapdao/sql/sql-map-config.xml"/>
</transactionManager>
<dao interface="com.ibatis.jpetstore.persistence.iface.ItemDao"
implementation="com.ibatis.jpetstore.persistence.sqlmapdao.ItemSqlMapDao"/>
<dao interface="com.ibatis.jpetstore.persistence.iface.SequenceDao"
implementation="com.ibatis.jpetstore.persistence.sqlmapdao.SequenceSqlMapDao"/>
<dao interface="com.ibatis.jpetstore.persistence.iface.AccountDao"
implementation="com.ibatis.jpetstore.persistence.sqlmapdao.AccountSqlMapDao"/>
<dao interface="com.ibatis.jpetstore.persistence.iface.CategoryDao"
implementation="com.ibatis.jpetstore.persistence.sqlmapdao.CategorySqlMapDao"/>
<dao interface="com.ibatis.jpetstore.persistence.iface.ProductDao"
implementation="com.ibatis.jpetstore.persistence.sqlmapdao.ProductSqlMapDao"/>
<dao interface="com.ibatis.jpetstore.persistence.iface.OrderDao"
implementation="com.ibatis.jpetstore.persistence.sqlmapdao.OrderSqlMapDao"/>
</context>
</daoConfig>
l sql-map-config.xml
定义了iBatis的sql map的主要配置文件,定义了事务管理器和sqlmap文件。
<sqlMapConfig>
<properties resource="properties/database.properties"/>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property value="${driver}" name="JDBC.Driver"/>
<property value="${url}" name="JDBC.ConnectionURL"/>
<property value="${username}" name="JDBC.Username"/>
<property value="${password}" name="JDBC.Password"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/ibatis/jpetstore/persistence/sqlmapdao/sql/Account.xml"/>
<sqlMap resource="com/ibatis/jpetstore/persistence/sqlmapdao/sql/Category.xml"/>
<sqlMap resource="com/ibatis/jpetstore/persistence/sqlmapdao/sql/Product.xml"/>
<sqlMap resource="com/ibatis/jpetstore/persistence/sqlmapdao/sql/Sequence.xml"/>
<sqlMap resource="com/ibatis/jpetstore/persistence/sqlmapdao/sql/LineItem.xml"/>
<sqlMap resource="com/ibatis/jpetstore/persistence/sqlmapdao/sql/Order.xml"/>
<sqlMap resource="com/ibatis/jpetstore/persistence/sqlmapdao/sql/Item.xml"/>
</sqlMapConfig>
l messages.properties
系统的资源文件
l database.properties
定义了sqlmap配置文件里需要引用到的变量
l Account.xml
具体的sql定义文件
l validation.xml
struts的validation框架配置文件,在struts-config.xml里作为plugin引入。