applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="com.tiantian.tiantian" />
<context:property-placeholder location="classpath:jdbc.properties" />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.tiantian.tiantian.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<aop:config>
<aop:pointcut id="productServiceMethods"
expression="execution(* com.tiantian.tiantian..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="productServiceMethods" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="false" />
<constant name="struts.enable.SlashesInActionNames" value="true" />
<constant name="struts.mapper.alwaysSelectFullNamespace"
value="false" />
<package name="default" namespace="/" extends="struts-default">
<interceptors>
<interceptor name="authentication" class="com.tiantian.tiantian.web.interceptor.AuthenticationInterceptor"></interceptor>
<interceptor-stack name="myInterceptorStack">
<interceptor-ref name="authentication"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myInterceptorStack"/>
<default-action-ref name="mydefault"/>
<global-results>
<result name="forbidden">/WEB-INF/forbidden.jsp</result>
<result name="Exception">/WEB-INF/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="Exception" exception="java.lang.Exception"></exception-mapping>
</global-exception-mappings>
<action name="mydefault">
<result type="redirect">/</result>
</action> <!-- 当输入的地址不存在的时候就转到主页 -->
</package>
<!-- Add packages here -->
</struts>
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">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- <error-page>-->
<!-- <error-code>404</error-code>-->
<!-- <location>/404.jsp</location>-->
<!-- </error-page>-->
<!-- <error-page>-->
<!-- <error-code>500</error-code>-->
<!-- <location>/500.jsp</location>-->
<!-- </error-page> -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dwr</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>servletFilter</filter-name>
<filter-class>com.tiantian.tiantian.web.filter.ServletFilter</filter-class>
<init-param>
<param-name>targets</param-name>
<param-value>LogoutServlet</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>servletFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<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>
</web-app>
分享到:
相关推荐
Linux 中的一些常用配置文件及其功能
nginx的一些常用配置文件
Linux常用配置文件及常用命令 Linux常用配置文件及常用命令
常用mysql数据库配置文件常用mysql数据库配置文件常用mysql数据库配置文件常用mysql数据库配置文件常用mysql数据库配置文件常用mysql数据库配置文件常用mysql数据库配置文件常用mysql数据库配置文件常用mysql数据库...
资源描述:本文件为creo常用配置文件。详细表述见https://blog.csdn.net/qq_39979317/article/details/107569930 使用方法:下载此文件,替换安装目录D:\Creo6.0\PTC\Creo 6.0.0.0\Common Files\text目录下的config....
OpenGL的常用配置文件,解决初学者学习OpengGL时配置环境的困扰。
java开发中常用的模板,包含 spring配置文件,mybatis,mvc配置文件
Linux系统中常用配置文件,这该死的20字符
JAVAWEB各种配置文件加常用操作(spring strut2 jpa hibernate jdbc jndi springMVC velocity ant log4j ehcache等各种配置文件及常用操作),相信对你的开发一定会有很大的帮助!
vim常用配置,插件,用于形成打造VIMIDE
主要包括red hat enterprise linux服务器常用配置与配置文件范本,配置的ppt课件,以及swf格式的测试题(有答案)。
开发中常用jsp配置文件,大家可以下载看看!很有帮助的!
emacs常用配置文件,包括 行号显示、载入 主题、 org-mode常用配置。下载后请放到 ~主目录下即可,或者自己新建一个.emacs,用记事本打开拷过去。
我自己的vim配置文件,包括常用的代码不全,git提示,nerdtree,taglist等。 复制到根目录下重命名为.vimrc
ssh这个是常用的配置文件,里面包含hibernate.cfg.xml\struts.xml\beans.xml\log4j.properties\web.xml等等,是开发必备的配置文件
常用的一些开发配置文件.7z
导入MyEclipse后即可~~方便重新安装MyEclipse的朋友使用
Nginx的常用配置文件,适合负载均衡设置等
本文是对.Net配置文件常用配置的说明。
Vim 配置文件。 支持ctags/cscope的配置。可以动态的进行代码的跳转高亮等