日期:2014-05-19  浏览次数:20743 次

【分享】基于全注解的SSH简单框架
以前用的框架太老了,而且是基于配置文件的,所以重新建了一个几乎是最新版本的SSH框架。除了没用Hibernate4.0以外

文字没变色,不知道怎么回事,想看变色的移步我的博客吧http://www.wuliaoji.com/2012/04/20/%E5%9F%BA%E4%BA%8E%E5%85%A8%E6%B3%A8%E8%A7%A3%E7%9A%84ssh%E7%AE%80%E5%8D%95%E6%A1%86%E6%9E%B6.html

整个框架25MB左右。


1,
hibernate版本hibernate-distribution-3.6.10.Final
struts版本struts-2.3.1.2
spring版本spring-framework-3.1.1.RELEASE
aspectj版本aspect-1.6.12(用来产生动态代理的,所谓面向切面编程)

2,
包的列表,这边就不分了吧。。spring是全导进去了的,hibernate复制了required文件下的,struts按需求导入,导多了要报错。
antlr-2.7.6.jar
aopalliance-1.0.jar
asm-3.3.jar
asm-all-3.2.jar
asm-commons-3.3.jar
aspectj-1.6.12.jar
aspectjrt.jar
aspectjweaver.jar
cglib-nodep-2.1_3.jar
commons-collections-3.1.jar
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
dom4j-1.6.1.jar
freemarker-2.3.18.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-testing.jar
hibernate3.jar
javassist-3.12.0.GA.jar
jta-1.1.jar
mysql-connector-java-5.1.19-bin.jar
ognl-3.0.4.jar
org.springframework.aop-3.1.1.RELEASE.jar
org.springframework.asm-3.1.1.RELEASE.jar
org.springframework.aspects-3.1.1.RELEASE.jar
org.springframework.beans-3.1.1.RELEASE.jar
org.springframework.context-3.1.1.RELEASE.jar
org.springframework.context.support-3.1.1.RELEASE.jar
org.springframework.core-3.1.1.RELEASE.jar
org.springframework.expression-3.1.1.RELEASE.jar
org.springframework.instrument-3.1.1.RELEASE.jar
org.springframework.instrument.tomcat-3.1.1.RELEASE.jar
org.springframework.jdbc-3.1.1.RELEASE.jar
org.springframework.jms-3.1.1.RELEASE.jar
org.springframework.orm-3.1.1.RELEASE.jar
org.springframework.oxm-3.1.1.RELEASE.jar
org.springframework.test-3.1.1.RELEASE.jar
org.springframework.transaction-3.1.1.RELEASE.jar
org.springframework.web-3.1.1.RELEASE.jar
org.springframework.web.portlet-3.1.1.RELEASE.jar
org.springframework.web.servlet-3.1.1.RELEASE.jar
org.springframework.web.struts-3.1.1.RELEASE.jar
slf4j-api-1.6.1.jar
struts2-config-browser-plugin-2.3.1.2.jar
struts2-convention-plugin-2.3.1.2.jar
struts2-core-2.3.1.2.jar
struts2-spring-plugin-2.3.1.2.jar
xwork-core-2.3.1.2.jar

3,
web.xml
<?xml version= "1.0" encoding ="UTF-8"?>
<web-app version= "2.5" xmlns ="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >
  <display-name></ display-name>
  <welcome-file-list>
  <welcome-file> index.jsp</welcome-file >
  </welcome-file-list>

  <!-- struts配置 -->
  <filter>
  <filter-name> struts2</ filter-name>
  <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class>
  </filter>

  <filter-mapping>
  <filter-name> struts2</ filter-name>
  <url-pattern> /*</ url-pattern>
  </filter-mapping>

  <!-- 加载spring监听器,用来在struts中注入 -->
  <listener>
  <listener-class> org.springframework.web.context.ContextLoaderListener</listener-class >