1.文档说明:
我的Csdn http://blog.csdn.net/zl563143188
spring3.1 http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/
struts2 http://struts.apache.org/2.x/docs/home.html
hibernate http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/
这是我的QQ空间,欢迎参观 http://user.qzone.qq.com/563143188
程序源码下载地址 10MB:http://115.com/file/c2re58pm # (最新程序请下载附件 )
apache-tomcat -6.0.33请下载附件
程序lib下载地址 100MB:http://115.com/file/c2re52n6 #
数据库下载地址 (可以将数据转为sql,或者mysql,默认access)http://115.com/file/andcz97r #
由于涉及技术比较多,一般很难运行成功,需要技术指导联系 QQ 563143188,电话 13823045912 张林
Struts2 、 Spring 、 Hibernate 三者整合的过程示例
SSH简单整合( Struts2 .2.3.1+ Spring3 .1.0+ Hibernate4)
Struts2 + Spring + Hibernate 搭建全解!
Hibernate4 Struts2 Spring3 整合
?
功能介绍:
1.支持 Hibernate连接Access Hibernate连接sqlsever Hibernate连接mysql
2.支持 Spring连接access数据库 spring连接mysql spring连接sqlsever数据库
3.支持 Spring动态数据源加载 Spring连接ibaits Spring JDBC连接
4.支持 Spring的事务管理 Spring AOP实现 Spring的权限管理
5.支持 Spring MVC及Spring国际化标签 Spring文件上传下载
6.支持 Spring 数据源加载属性文件
7.支持 struts2+hibernate4+spring3 及struts2+itbaits+spring设计结构
8.支持 ext+json+treepanel实现动态树
9.支持 jasperreport+ireport+excel打印
10.支持 freemarker 生成文件
11.支持 sitemesh修饰网站
12. 支持 oscahe缓存 hibernate+ehcache缓存
13. 支持 struts2国际化
14 支持 velocity模板设计
15.支持 ext+dwr+json处理数据
16.支持 jquery图表制作
17.支持 log4j日志处理
18.支持 hibernate与ibaits同时访问数据库
19.支持 java读dll,ocx控制
20.支持 SSH、SSI框架同时使用
21.支持 Spring实时调度任务
22.支持随意更改BaseDaoImpl<T extends BaseModel,PK extends BasePK> extends BaseHibernate4SpringDaoImpl<T,PK>
?
?
?
?
一、配置文件
1.spring的配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance " xmlns:aop="http://www.springframework.org/schema/aop "
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr "
xmlns:mvc="http://www.springframework.org/schema/mvc " xmlns:tx="http://www.springframework.org/schema/tx "
xmlns:context="http://www.springframework.org/schema/context "
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.directwebremoting.org/schema/spring-dwr
http://www.directwebremoting.org/schema/spring-dwr-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd "
default-autowire="byName">
<!-- bean id="log4j" class="com.init.system.InitLog4j"></bean-->
<!-- import resource="spring-datasource.xml" /-->
<!-- auto scan spring component>
<context:annotation-config /-->
<!--
自动扫描组件,这里要把web下面的
controller去除,他们是在spring3-servlet.xml中配置的,如果不去除会影响事务管理的。
-->
<context:component-scan base-package="com.senlo.analyze">
<!--
controller一般是action层的
此处只应该加载表现层组件,如果此处还加载dao层或service层的bean会将之前容器加载的替换掉,而且此处不会进行AOP织入,所以会造成AOP失效问题(如事务不起作用),
-->
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<!-- 加上这名就会自动扫描对象带有@aspect的注解 ,不过我现在只是采用了xml的注解的方法,annotation暂不用-->
<!-- aop:aspectj-autoproxy /-->
<bean
class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"></bean>
<bean
class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" />
<!-- order值越小, 优先级越高 -->
<bean
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="1" />
</bean>
<bean
class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<property name="order" value="2" />
</bean>
<!-- 启动Spring MVC的注解功能,完成请求和注解POJO -->
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver" />
<!--
Configures the @Controller programming model
必须加上这个,不然请求controller时会出现no mapping url错误
-->
<!-- enable autowire >
<mvc:annotation-driven /-->
?
<!-- 加载属性文件 01-->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:msg/system/exception_zh_CN.properties</value>
<value>classpath:msg/system/message_en_US.properties</value>
<value>classpath:msg/system/message_zh_CN.properties</value>
<value>classpath:msg/senlo/senlo_en_US.properties</value>
<value>classpath:msg/senlo/senlo_zh_CN.properties</value>
<value>classpath:msg/config/config.properties</value>
</list>
</property>
</bean>
<!-- dbcp配置 -->
<bean id="dbcp" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<!--连接池启动时的初始化 -->
<property name="initialSize" value="1" />
<!--连接池的最大值 -->
<property name="maxActive" value="30" />
<!-- 最大空闲值,当经过一个高峰时间后,连接池可以慢慢将已经用不到的链接慢慢释放一部分,一直减少到maxle为止 -->
<property name="maxIdle" value="2" />
<!-- 最小空闲值,当空闲的连接数少于阀值时,连接池就会预申请去一些链接,以免洪峰来时来不及申请 -->
<property name="minIdle" value="1" />
<!-- 运行判断连接超时任务的时间间隔,单位为毫秒,默认为-1,即不执行任务。 -->
<property name="timeBetweenEvictionRunsMillis" value="3600000" />
<!-- 连接的超时时间,默认为半小时。 -->
<property name="minEvictableIdleTimeMillis" value="3600000" />
</bean>
<!-- xml定义aspect拦截器 -->
<bean id="loginInterceptor"
class="com.senlo.analyze.core.interseptor.system.LoginInterceptor" />
<aop:config>
<aop:pointcut
expression="execution(public * com.senlo.analyze.core.common.dao..*.*(..))"
id="logPointcut" />
<aop:aspect id="logAspect" ref="loginInterceptor">
<aop:before method="StartUserLog" pointcut-ref="logPointcut" />
</aop:aspect>
</aop:config>
<!-- hibernate 3 配置 org.springframework.orm.hibernate3.LocalSessionFactoryBean
这个是读取hbml.xml文件的方式 -->
<!-- hibernate 3 org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
这个是读取带@Entity注解的方式 -->
<!-- org.springframework.orm.hibernate4.LocalSessionFactoryBean -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<!-- 此处应注入ibatis配置文件,而非sqlMap文件,否则会出现“there is no statement.....异常” -->
<property name="dataSource">
<ref local="dbcp" />
</property>
<property name="configLocation">
<value>classpath:senlo-ibatis.config.xml</value>
</property>
</bean>
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
?
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<!--
property name="dataSource">只有外部文件的才能用ref <ref bean="dbcp"></ref>
</property
-->
<property name="dataSource">
<ref local="dbcp" />
</property>
<property name="hibernateProperties">
<props>
<prop key="show_sql">true</prop>
<!--
prop key="hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory </prop
-->
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.jdbc.fetch_size">10</prop>
<prop key="hibernate.jdbc.batch_size">10</prop>
<prop key="hibernate.default_batch_fetch_size">10</prop>
<!-- JDBC connection pool (use the built-in) -->
<prop key="connection.pool_size">1</prop>
<!-- Enable Hibernate's automatic session context management -->
<!-- prop key="current_session_context_class">thread</prop-->
<prop key="format_sql">true</prop>
<!--
able the second-level cache
net.sf.ehcache.hibernate.SingletonEhCacheProvider
-->
<!-- prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider
</prop -->
<!--
prop key="hibernate.cache.use_second_level_cache">true</prop> <prop
key="hibernate.cache.use_query_cache">true</prop
-->
</props>
</property>
<property name="packagesToScan" value="com.senlo.analyze..**">
</property>
</bean>
<!-- DAO 的IoC配置//-->
<!--
bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" /> </bean
-->
<!--
mybatis接口 > <bean
class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property
name="basePackage" value="com.chenxin.authority.dao" /> </bean
-->
<!--
bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate"> <property
name="dataSource" ref="dbcp" /> </bean
-->
<!-- 配置事务管理器 01-->
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<!--
property name="dataSource"> <ref bean="dbcp" /> </property
-->
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- 配置事务管理器02 -->
<!--
bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dbcp" /> </bean
-->
<!-- jpa配置事务 管理器03-->
<!--
bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager"> <property
name="entityManagerFactory" ref="sessionFactory" /> </bean
-->
<!-- 连接事务的注解配置 -->
<tx:annotation-driven transaction-manager="transactionManager" />
<!-- 配置事务的传播特性01 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="Find*" propagation="REQUIRED" read-only="true" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="create*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="merge*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="put*" propagation="REQUIRED" />
<tx:method name="use*" propagation="REQUIRED" />
<!--hibernate4必须配置为开启事务 否则 getCurrentSession()获取不到-->
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="count*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="list*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- 配置事务的传播特性02 -->
<!--
<bean id="txAdvice"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true" lazy-init="default" autowire="default"
dependency-check="default"> <property name="dao"> <ref
bean="transactionManager" /> </property> <property
name="transactionAttributes"> <props> <prop
key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop
key="update*">PROPAGATION_REQUIRED,-IEMSRollBackException</prop>
</props> </property> </bean>
-->
<!-- 那些类的哪些方法参与事务 -->
<aop:config>
<aop:pointcut id="allManagerMethod"
expression="execution(public * com.senlo.analyze.core.common.dao.Impl..*.*(..))" />
<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice" />
</aop:config>
?
<!--
mvc:interceptors> <bean
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" /
-->
<!-- 解决延迟加载 -->
<!--
bean
class="org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor">
<property name="entityManagerFactory"> <ref bean="sessionFactory" />
</property> </bean> </mvc:interceptors
-->
?
?
<!-- DWR 配置 BEGIN -->
<!-- 启动 DWR 注解配置模式 这句的作用是表示允许DWR访问Spring的Contex -->
<!--dwr:annotation-config /-->
<!-- 扫描加了注解@RemoteProxy & @RemoteMethod 的对象 -->
<!--
dwr:annotation-scan scanRemoteProxy="false" base-package="com.login" /
-->
<!-- dwr初始化配置 -->
<!-- dwr:configuration></dwr:configuration-->
<!-- dwr:url-mapping /-->
<!-- 开启dubug状态 -->
<!--<dwr:controller debug="true" />-->
<!-- DWR 配置 END-->
<!-- jsp视图 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/views/" />
<property name="suffix" value=".jsp" />
</bean>
?
<!--开发期间注释掉,上线后启用 错误解析器 发生错误默认会跳转到/web-inf/views/timeout.jsp -->
<!--
<bean id="exceptionResolver"
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="defaultErrorView" value="timeout" /> <property
name="exceptionMappings"> <props> <prop
key="java.sql.SQLException">timeout</prop> <prop
key="java.lang.RuntimeException">timeout</prop> <prop
key="org.springframework.transaction.TransactionException">timeout</prop>
<prop key="org.springframework.dao.DataAccessException">timeout</prop>
</props> </property> </bean>
-->
<!-- 国际化,并且可以批定文件编码,可以使用classpath: 或者WEB-INF/ 前缀 -->
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename">
<value>classpath:msg.system.message</value>
</property>
<property name="defaultEncoding" value="UTF-8" />
<property name="cacheSeconds" value="60" />
</bean>
?
<!-- 文件上传 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 解析request的编码 ,Default is ISO-8859-1 -->
<property name="defaultEncoding" value="UTF-8" />
<!-- 设置最大允许的大小(字节)。-1表示没有限制(默认) 1024*1024*10=10MB -->
<property name="maxUploadSize" value="1048576000" />
<!--被允许的最大的内存的大小,Default is 10240 bytes -->
<property name="maxInMemorySize" value="20480" />
<!-- 一个类似懒加载的属性.可以定义该属性.让解析文件的时候再抛异常,然后Controller中定义异常处理的方法 -->
<property name="resolveLazily" value="true" />
</bean>
</beans>
2.struts配置文件:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd ">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.i18n.encoding" value="utf-8"></constant>
<!-- 下面的设置是可以静态的访问 -->
<constant name="struts.custom.i18n.resources" value="msg.senlo.senlo"></constant>
<constant name="struts.custom.i18n.resources" value="msg.system.message"></constant>
<constant name="struts.ognl.allowStaticMethodAccess" value="true"></constant>
<include file="struts/senlo.xml" />
</struts>
3.web.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd ">
<!-- 首页显示 -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--velocity Servlet start -->
<!--
servlet> <servlet-name>velocityServlet</servlet-name>
<servlet-class>com.senlo.anaylze.utils.system.VelocityUtils</servlet-class>
<init-param> <param-name>org.apache.velocity.properties</param-name>
<param-value>/WEB-INF/classes/velocity.properties</param-value>
</init-param> </servlet> <servlet-mapping>
<servlet-name>velocityServlet</servlet-name>
<url-pattern>*.vm</url-pattern> </servlet-mapping
-->
<!--velocity Servlet end -->
<!-- 配置过滤器 -->
<!--
filter> <filter-name>encoding</filter-name>
<filter-class>com.filter.system.EncodingFilter</filter-class>
<init-param> <param-name>charset</param-name>
<param-value>UTF-8</param-value> </init-param> </filter>
<filter-mapping> <filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
<filter-name>encoding</filter-name> <url-pattern>*.do</url-pattern>
</filter-mapping
-->
<!-- 这里是sitemesh的配置 -->
<!--
filter> <filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
<init-param> <param-name>debug.pagewriter</param-name>
<param-value>true</param-value> </init-param> </filter>
<filter-mapping> <filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern> </filter-mapping> <taglib>
<taglib-uri>sitemesh-decorator</taglib-uri>
<taglib-location>/WEB-INF/sitemesh-decorator.tld</taglib-location>
</taglib> <taglib> <taglib-uri>sitemesh-page</taglib-uri>
<taglib-location>/WEB-INF/sitemesh-page.tld</taglib-location> </taglib
-->
<!-- sitemesh end -->
<!-- 这里是struts1.0的配置 -->
<!--
servlet> <servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param> <param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value> </init-param>
<init-param> <param-name>debug</param-name>
<param-value>3</param-value> </init-param> <init-param>
<param-name>detail</param-name> <param-value>3</param-value>
</init-param> <load-on-startup>0</load-on-startup> </servlet>
<servlet-mapping> <servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern> </servlet-mapping
-->
<!-- 这里是struts2.1的配置 -->
?
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!-- 为了修正struts2中上下文的错误 -->
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 加载spring的配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
?
?
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 著名 Character Encoding filter -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<!-- 强制进行转码 -->
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
?
<!-- 解决不能识别*.ico的图片 -->
<!--
servlet-mapping> <servlet-name>default</servlet-name>
<url-pattern>*.ico</url-pattern> </servlet-mapping
-->
<!--
使Spring支持request与session的scope,如:<bean id="loginAction"
class="com.foo.LoginAction" scope="request"/>
-->
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<!-- Spring 刷新Introspector防止内存泄露 -->
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<!-- singleSession默认为true,若设为false则等于没用OpenSessionInView -->
<!--
作用
在hibernate中使用load方法时,并未把数据真正获取时就关闭了session,当我们真正想获取数据时会迫使load加载数据,而此时session已关闭,所以就会出现异常。
-->
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<jsp-config>
<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/spring.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/spring-form.tld</taglib-location>
</taglib>
</jsp-config>
<!-- 配置oscahe缓存 -->
<!--
jsp-config> <taglib> <taglib-uri>oscache</taglib-uri>
<taglib-location>/WEB-INF/classes/oscache.tld</taglib-location>
</taglib> </jsp-config
-->
<!-- dwr的配置 -->
<!--
servlet> <servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
<init-param> <param-name>debug</param-name>
<param-value>true</param-value> </init-param> <init-param>
<param-name>config</param-name> <param-value> /WEB-INF/dwr.xml
</param-value> </init-param> </servlet> <servlet> <description>This is
the description of my J2EE component</description> <display-name>This
is the display name of my J2EE component</display-name>
<servlet-name>TestReportServlet</servlet-name>
<servlet-class>com.senlo.analyze.print.test.TestReportServlet</servlet-class>
</servlet> <servlet> <description>This is the description of my J2EE
component</description> <display-name>This is the display name of my
J2EE component</display-name>
<servlet-name>ServletDownload</servlet-name>
<servlet-class>com.senlo.analyze.tools.common.ServletDownload</servlet-class>
</servlet> <servlet> <description>This is the description of my J2EE
component</description> <display-name>This is the display name of my
J2EE component</display-name>
<servlet-name>ServletUpload</servlet-name>
<servlet-class>com.senlo.analyze.tools.common.ServletUpload</servlet-class>
</servlet> <servlet-mapping> <servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern> </servlet-mapping> <servlet-mapping>
<servlet-name>TestReportServlet</servlet-name>
<url-pattern>/TestReportServlet</url-pattern> </servlet-mapping>
<servlet-mapping> <servlet-name>ServletDownload</servlet-name>
<url-pattern>/ServletDownload</url-pattern> </servlet-mapping>
<servlet-mapping> <servlet-name>ServletUpload</servlet-name>
<url-pattern>/ServletUpload</url-pattern> </servlet-mapping> <servlet>
<servlet-name>hello</servlet-name>
<servlet-class>com.senlo.analyze.senlo.print.test.Hello</servlet-class>
</servlet> <servlet> <description>This is the description of my J2EE
component</description> <display-name>This is the display name of my
J2EE component</display-name> <servlet-name>AjaxServlet</servlet-name>
<servlet-class>com.senlo.analyze.tools.AjaxServlet</servlet-class>
</servlet> <servlet-mapping> <servlet-name>AjaxServlet</servlet-name>
<url-pattern>/servlet.AjaxServlet</url-pattern> </servlet-mapping>
<servlet-mapping> <servlet-name>hello</servlet-name>
<url-pattern>/myForm</url-pattern> </servlet-mapping
-->
<!--
配置错误请求> <error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/view/exceptions/nullPointer.jsp</location> </error-page>
<error-page>
<exception-type>java.lang.ArrayIndexOutOfBoundsException</exception-type>
<location>/view/exceptions/arrayIndexOut.jsp</location> </error-page>
<error-page> <error-code>404</error-code>
<location>/view/exceptions/404.jsp</location> </error-page>
<error-page> <exception-type>500</exception-type>
<location>/view/exceptions/500.jsp</location> </error-page>
<error-page> <exception-type>405</exception-type>
<location>/view/exceptions/405.jsp</location> </error-page
-->
<!-- 如果加上这名话,在url地址里面是不能直接用地址访问的 -->
<!--
security-constraint> <web-resource-collection>
<web-resource-name>jspMaster</web-resource-name>
<url-pattern>/view/*</url-pattern> </web-resource-collection>
<auth-constraint> <role-name>administrator</role-name>
<role-name>zhanglin</role-name> </auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint> </security-constraint
-->
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<!-- 默认读取log4j配置 -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>WEB-INF/classes/log4jSpring.properties</param-value>
</context-param>
<init-param>
<param-name>log4j-configuration</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</init-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- 系统初始化监听器 -->
<!--
listener>
<listener-class>com.listener.system.SystemInitListener</listener-class>
</listener
-->
</web-app>
4.dwr配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
"http://getahead.org/dwr/dwr20.dtd ">
<dwr>
<allow>
<create javascript="sensorbjDao" creator="new">
<param name="class"
value="com.xbs.crm.crm.biz.bizImpl.SensorbjBizImp">
</param>
</create>
<convert converter="bean" match="com.xbs.crm.wpgl.bean.*"></convert>
<convert converter="bean" match="com.xbs.crm.crm.bean.*"></convert>
</allow>
5.ehache配置文件:
<ehcache>
<diskStore path="java.io.tmpdir" />
<defaultCache maxElementsInMemory="10000" eternal="false"
timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true"
diskSpoolBufferSizeMB="30" maxElementsOnDisk="10000000"
diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU" />
<cache name="DEFAULT_CACHE" maxElementsInMemory="50" eternal="false"
timeToIdleSeconds="3600" timeToLiveSeconds="7200" overflowToDisk="false" />
<cache name="org.hibernate.cache.UpdateTimestampsCache"
maxElementsInMemory="50" eternal="false" timeToIdleSeconds="3600"
timeToLiveSeconds="7200" overflowToDisk="false" />
<cache name="org.hibernate.cache.StandardQueryCache"
maxElementsInMemory="5000" eternal="true" overflowToDisk="true" />
6.log4j配置文件
##log4j.rootLogger=DEBUG,CONSOLE,DATABASE,FILE,DATABASE
log4j.rootLogger=DEBUG,CONSOLE,FILE
log4j.addivity.org.apache=true
#
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.Encoding=UTF-8
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[framework] %d -%-4r [%t] %-5p %c %x - %m%n
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.File=${catalina.base}/webapps/zl/logs/system.log
log4j.appender.A1.Encoding=UTF-8
log4j.appender.A1.Threshold=CONSOLE
log4j.appender.A1.DatePattern='.'yyyy-MM-dd
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %5p {1}:%L : %m%n
log4j.appender.FILE=org.apache.log4j.FileAppender
#log4j.appender.A1.File=WEB-INF\\logs\\bysxxglxt.log
#C:/log4j/file.log ${WORKDIR} ?tomcat webapp.root??
log4j.appender.FILE.File=${catalina.base}/webapps/zl/logs/system.log
log4j.appender.FILE.Append=false
log4j.appender.FILE.Encoding=UTF-8
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=[framework] %d -%-4r [%t] %-5p %c %x - %m%n
#
log4j.appender.ROLLING_FILE=org.apache.log4j.RollingFileAppender
log4j.appender.ROLLING_FILE.Threshold=ERROR
log4j.appender.ROLLING_FILE.File=rolling.log
log4j.appender.ROLLING_FILE.Append=true
log4j.appender.CONSOLE_FILE.Encoding=UTF-8
log4j.appender.ROLLING_FILE.MaxFileSize=10KB
log4j.appender.ROLLING_FILE.MaxBackupIndex=1
log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.ROLLING_FILE.layout.ConversionPattern=[framework] %d -%-4r [%t] %-5p %c %x - %m%n
#Appender
#log4j.appender.im = net.cybercorlin.util.logger.appender.IMAppender
#log4j.appender.im.host = mail.cybercorlin.net
#log4j.appender.im.username = username
#log4j.appender.im.password = password
#log4j.appender.im.recipient =
#log4j.appender.im.layout=org.apache.log4j.PatternLayout
#log4j.appender.im.layout.ConversionPattern =[framework] %d -%-4r [%t] %-5p %c %x - %m%n
#???socket
#log4j.appender.SOCKET=org.apache.log4j.RollingFileAppender
#log4j.appender.SOCKET.RemoteHost=localhost
#log4j.appender.SOCKET.Port=5001
#log4j.appender.SOCKET.LocationInfo=true
# Set up for Log Facter 5
#log4j.appender.SOCKET.layout=org.apache.log4j.PatternLayout
#log4j.appender.SOCET.layout.ConversionPattern=[start]%d{DATE}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD]%n%c[CATEGORY]%n%m[MESSAGE]%n%n
# Log Factor 5 Appender
#log4j.appender.LF5_APPENDER=org.apache.log4j.lf5.LF5Appender
#log4j.appender.LF5_APPENDER.MaxNumberOfRecords=2000
#
#log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender
#log4j.appender.MAIL.Threshold=FATAL
#log4j.appender.MAIL.BufferSize=10
#log4j.appender.MAIL.From=
#log4j.appender.MAIL.SMTPHost=www.wusetu.com
#log4j.appender.MAIL.Subject=Log4J Message
#log4j.appender.MAIL.To=we
#log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout
#log4j.appender.MAIL.layout.ConversionPattern=[framework] %d -%-4r [%t] %-5p %c %x - %m%n
7.struts2.property
struts.i18n.encoding=UTF-8
struts.custom.i18n.resources=msg.senlo.senlo,msg.system.message
struts.multipart.maxSize=1000000000
struts.devMode=fase
struts.url.includeParams=none
8.jdbc.property配置文件
#Oracle?????
#ConUsePool true use connection pool,false not use connection pool
ConUsePool=true
#DsName datasource name
#DsName=gtcs
#DbType:database type
#DbType=oracle---------------------------
#jdbc.driver=oracle.jdbc.driver.OracleDriver
#jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:ora9i
#jdbc.username=gtcs
#jdbc.password=11
#SQL Server------------------------------
#jdbc.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
#jdbc.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=wpgl
#jdbc.username=sa
#jdbc.password=
#My SQL----------------------------------
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1/anydata?useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=root
#select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual
#Aceess----------------------------------
#jdbc.driver=sun.jdbc.odbc.JdbcOdbcDriver
#jdbc.url=jdbc\:odbc\:driver\={Microsoft Access Driver (*.mdb)};DBQ\=E\:\\workspace\\anydata003.mdb
#jdbc.username=
#jdbc.password=
#proxool db
#proxool.driver=oracle.jdbc.driver.OracleDriver
#proxool.url=jdbc:oracle:thin:@192.168.1.16:1521:ETLDBS
#proxool.username=report
#proxool.password=report
#proxool.alias=dbpool
#proxool.prototypeCount=5
#proxool.maximumConnectionCount=100
#proxool.minimumConnectionCount=10
?
9.ibaits配置文件:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd ">
<sqlMapConfig>
<!-- settings cacheModelsEnabled="true" enhancementEnabled="true"
lazyLoadingEnabled="true" maxRequests="32" maxSessions="20"
maxTransactions="10" useStatementNamespaces="true" />
<typeHandler javaType="java.lang.String" jdbcType="CLOB"
callback="com.ibatis.sqlmap.engine.type.ClobTypeHandlerCallback" />
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver"
value="oracle.jdbc.driver.OracleDriver" />
<property name="JDBC.ConnectionURL"
value="jdbc:oracle:thin:@127.0.0.1:1521:ora9i" />
<property name="JDBC.Username" value="base_gov" />
<property name="JDBC.Password" value="11" />
<property name="Pool.MaximumActiveConnections" value="10" />
<property name="Pool.MaximumIdleConnections" value="10" />
<property name="Pool.MaximumCheckoutTime" value="120000" />
<property name="Pool.TimeToWait" value="500" />
<property name="Pool.PingQuery" value="select 1 from dual" />
<property name="Pool.PingEnabled" value="false" />
<property name="Pool.PingConnectionsOlderThan" value="1" />
<property name="Pool.PingConnectionsNotUsedFor" value="1" />
</dataSource>
</transactionManager -->
<settings cacheModelsEnabled="true" enhancementEnabled="true"
lazyLoadingEnabled="true" maxRequests="32" maxSessions="20"
maxTransactions="10" useStatementNamespaces="true" />
<!-- properties url="file:///c " /-->
<transactionManager type="JDBC">
<!-- access数据库>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver"
value="sun.jdbc.odbc.JdbcOdbcDriver" />
<property name="JDBC.ConnectionURL"
value="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=E:\\apache-tomcat-6.0.33\\webapps\\wjh\\db\\wpgl.mdb" />
<property name="JDBC.Username" value="" />
<property name="JDBC.Password" value="" />
</dataSource>
</transactionManager>
<sql数据库>
<dataSource type="SIMPLE">
<property name="JDBC.Driver"
value="net.sourceforge.jtds.jdbc.Driver" />
<property name="JDBC.ConnectionURL"
value="jdbc:jtds:sqlserver://127.0.0.1:1433/wpgl" />
<property name="JDBC.Username" value="sa" />
<property name="JDBC.Password" value="" />
</dataSource>
<oracle数据库>
<dataSource type="SIMPLE">
<property name="JDBC.Driver"
value="oracle.jdbc.driver.OracleDriver" />
<property name="JDBC.ConnectionURL"
value="jdbc:oracle:thin:@127.0.0.1:1521:ora10g" />
<property name="JDBC.Username" value="ltmail" />
<property name="JDBC.Password" value="aa" />
</dataSource>
<mysql数据库>
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.mysql.jdbc.Driver" />
<property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1:3306/intouch2" />
<property name="JDBC.Username" value="root" />
<property name="JDBC.Password" value="root" />
</dataSource-->
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="sun.jdbc.odbc.JdbcOdbcDriver" />
<property name="JDBC.ConnectionURL" value="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=E:\\db\\crm.mdb" />
<property name="JDBC.Username" value="" />
<property name="JDBC.Password" value="" />
</dataSource>
</transactionManager>
?
有时候可能需要你注册吧,我刚刚检测了,可以下载,如果需要告诉我你的邮箱,我发给你。