一 整个项目的框架,文件夹分布

二 一些重要的配置文件
2.1 struts.xml
此配置文件主要申明了
然后引入一些
具体的struts配置还是利用上面的引入,分布到具体的模块去些,这里只是一个集合,方便管理。
Xml代码
< xml version="1.0" encoding="UTF-8" >
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
2.2 某个模块的struts配置文件,xxxStruts.xml
在这个配置文件,主要申明了某个模块用哪个Action类来控制和这个控制类处理之后的页面跳转结果页面。由于是利用Spring来管理struts,配置文件里写的处理类名字,其实是在Spring的bean配置文件里面申明好的一个id名字
Xml代码
< xml version="1.0" encoding="UTF-8" >
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
其中的
而
2.3 applicationContext.xml
这个配置文件配置了c3p0连接池,注入hibernate的mapping映射文件,注入了各个模块对应的SpringBean配置文件(里面申明了Aciton类和操作数据库接口实现类),还有申明了会话工厂sessionFactory,在接口实现类里面直接用sessionFactory就可以操作数据库相关,比如实例化连接池然后操作数据库之类。
Xml代码
< xml version="1.0" encoding="UTF-8" >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">