【引用】ssh配置文件(web.xml,struts.xml,applicationContext.xml,persistence.xml,log4j.properties)
来源:互联网 发布:华为麦芒4移动网络 编辑:程序博客网 时间:2024/05/16 05:18
web.xml修改如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Morningstar</display-name>
<!--spring config-->
<filter>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--struts config-->
<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>
<!--log4j config-->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>60000</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!--spring listener-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
2.右键点击projectName\Java Resources: src-->New-->Other...-->General-->File-->Next-->
Enter or select the parent folder: Spring3_HelloWorld/src , File name: struts.xml-->Finish
struts.xml修改成如下:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="struts-default.xml"/>
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.devMode" value="true" /> <!--开发模式-->
<!-- Add packages here -->
</struts>
3.右键点击Spring3_HelloWorld\WebContent\WEB-INF-->New-->File-->File name: applicationContext.xml-->Finish
applicationContext.xml修改成如下:
<?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:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="##" />
<property name="url" value="##"/>
<property name="username" value="##"/>
<property name="password" value="##"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="MYSQL" />
<property name="showSql" value="true" />
</bean>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
</beans>
4.右键点击projectName\Java Resources: src\META-INF-->New-->Other...-->General-->File-->Next-->
Enter or select the parent folder: Spring3_HelloWorld/src/META-INF , File name: persistence.xml-->Finish
persistence.xml修改成如下:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="punit">
</persistence-unit>
</persistence>
5.右键点击projectName\WebContentWEB-INF-->New-->File-->File name: log4j.properties-->Finish
log4j.properties修改成如下:
# Set root logger level to error
log4j.rootLogger=INFO, Console, File
###### Console appender definition #######
# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{3}] %m%n
#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=spring.log
log4j.appender.File.Append=false
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
注:在项目中web.xml、persistence.xml、log4j.properties是不用修改的,只需修改struts.xml和 applicationContext.xml,而且是一起修改。
- 【引用】ssh配置文件(web.xml,struts.xml,applicationContext.xml,persistence.xml,log4j.properties)
- 配置文件:persistence.xml-----beans.xml----jdbc.properties----log4j.properties---oscache----paoding---struts.config---web.xml
- ssh web.xml beans.xml applicationContext.xml struts.xml
- LOG4J 配置文件 properties --> XML
- ssh - 配置文件 - struts.xml
- SSH配置文件之applicationContext.xml
- log4j 配置文件 (XML/.properties)
- SSH整合配置applicationContext.xml/hibernate.cfg.xml/struts.xml
- ssh整合!Struts.xml、hibernate与spring整合的applicationContext.xml、web.xml文件的配置!
- ApplicationContext.xml中加载properties配置文件
- SSH整合applicationContext.xml配置文件(my project)
- struts2的struts.xml struts.properties配置文件
- applicationContext.xml的配置文件
- glxy配置文件 applicationcontext.xml
- applicationContext.xml的配置文件
- applicationcontext.xml配置文件1
- spring配置文件applicationContext.xml
- ApplicationContext.xml配置文件
- TreePanel的各项属性
- Hadoop大数据分析技术以及未来发展趋势
- Ext.window组件属性方法介绍
- 职场黄金法则20条
- cookie+session,会话时间设定
- 【引用】ssh配置文件(web.xml,struts.xml,applicationContext.xml,persistence.xml,log4j.properties)
- Myeclipse 工程各种包过滤显示
- 导出数据到Excel
- Ext文件下载(转载)
- SQL 批量插入
- 防止同一用户重复登录思路
- System.IO.FileNotFoundException: 未能加载文件或程序集
- JS 简单实现Ext.TabPanel效果(转载)
- C# 中split 的用法