ssh框架搭建Struts2 06+spring2 5+hibernate3 2整合例項程式碼教程步驟
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow
也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!
原創整理不易,轉載請註明出處:ssh框架搭建Struts2.06+spring2.5+hibernate3.2整合例項程式碼教程步驟
程式碼下載地址:http://www.zuidaima.com/share/1760074977233920.htm
最近閒來無事可做,於是開始學習struts2。Struts2和struts1、webwork2有什麼區別我也不說了,網上有很多這方面的資料。以前在專案中從未使用過struts,一直使用spring+hibernate,現在既然學習了Struts,也不能浪費,於是乎開始琢磨著怎麼整合這3個框架。整合原理以spring為容器,管理hibernate的DAO和Struts2的Action。
一、 準備工作
Struts2.06+spring2.5+hibernate3.2+jdk6.0+myeclipse6.0+tomcat5.5+mysql5.0
以上是整合的原料。下面以一個註冊登陸的例子來開始我們的整合過程。
這個例子很簡單,下面是它的sql指令碼內容:
CREATE TABLE `zuidaima_user` ( `userid` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(20) NOT NULL, `password` varchar(16) NOT NULL, `email` varchar(30) NOT NULL, PRIMARY KEY (`userid`)) ENGINE=InnoDB DEFAULT CHARSET=utf-8;
二、 開始行動
包結構可以參考下圖
圖一
圖二
圖三
1) Struts部分:建立struts.xml和struts.properties
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>
- <package name ="user_curd" extends ="struts-default" >
- <global-results>
- <!-- 下面定義的結果對所有的Action都有效 -->
- <result name ="exception"> /error.jsp </result>
- </global-results>
- <global-exception-mappings>
- <!-- 指Action丟擲Exception異常時,轉入名為exception的結果。 -->
- <exception-mapping exception ="java.lang.Exception" result ="exception" />
- </global-exception-mappings>
- <action name ="Login" class ="LoginAction">
- <result name ="success"> /success.jsp </result>
- <result name ="input"> /login.jsp </result>
- </action>
- <action name ="Regist" class ="RegistAction">
- <result name ="success"> /success.jsp </result>
- <result name ="input"> /regist.jsp </result>
- </action>
- </package>
- </struts>
<? 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> <package name ="user_curd" extends ="struts-default" > <global-results> <!-- 下面定義的結果對所有的Action都有效 --> <result name ="exception"> /error.jsp </result> </global-results> <global-exception-mappings> <!-- 指Action丟擲Exception異常時,轉入名為exception的結果。 --> <exception-mapping exception ="java.lang.Exception" result ="exception" /> </global-exception-mappings> <action name ="Login" class ="LoginAction"> <result name ="success"> /success.jsp </result> <result name ="input"> /login.jsp </result> </action> <action name ="Regist" class ="RegistAction"> <result name ="success"> /success.jsp </result> <result name ="input"> /regist.jsp </result> </action> </package> </struts>
Struts.properties內容如下:
- struts.devMode = false
- struts.enable.DynamicMethodInvocation = true
- struts.i18n.reload = true
- struts.ui.theme =xhtml
- struts.locale = zh_CN
- struts.i18n.encoding = UTF- 8
- struts.objectFactory = spring
- struts.objectFactory.spring.autoWire = name
- struts.serve.static.browserCache = false
- struts.url.includeParams = none
struts.devMode = falsestruts.enable.DynamicMethodInvocation = truestruts.i18n.reload = truestruts.ui.theme =xhtmlstruts.locale = zh_CNstruts.i18n.encoding = UTF- 8struts.objectFactory = springstruts.objectFactory.spring.autoWire = namestruts.serve.static.browserCache = falsestruts.url.includeParams = none
2) 建立User.java和User.hbm.xml、jdbc.properties:
User.java內容如下:
/** * * @author <a href="mailto:flustar2008@163.com">flustar</a> * @version 1.0 * Creation date: Dec 23, 2007 1:55:28 PM */package com.firstssh.model;import java.io.Serializable;public class User implements Serializable { private int id; private String username; private String password; private String email; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; }}
User.hbm.xml內容:
- <?xml version="1.0"?>
- <!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
- <hibernate-mapping
- package="com.firstssh.model">
- <class name="User" table="User">
- <id name="id" column="userid">
- <generator class="identity" />
- </id>
- <property name="username"
- column="username"
- not-null="true"
- length="20"
- />
- <property name="password"
- column="password"
- not-null="true"
- length="16" />
- <property name="email"
- column="email"
- not-null="true"
- length="30"/>
- </class>
- </hibernate-mapping>
<?xml version="1.0"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping package="com.firstssh.model"> <class name="User" table="User"> <id name="id" column="userid"> <generator class="identity" /> </id> <property name="username" column="username" not-null="true" length="20" /> <property name="password" column="password" not-null="true" length="16" /> <property name="email" column="email" not-null="true" length="30"/> </class> </hibernate-mapping>
jdbc.properties內容如下:
- datasource.type = mysql
- datasource.driverClassName = com.mysql.jdbc.Driver
- datasource.url = jdbc:mysql://localhost: 3306 /test?useUnicode = true&characterEncoding = UTF- 8
- datasource.username = root
- datasource.password = 123456
- datasource.maxActive = 10
- datasource.maxIdle = 2
- datasource.maxWait = 120000
- datasource.whenExhaustedAction = 1
- datasource.validationQuery = select 1 from dual
- datasource.testOnBorrow = true
- datasource.testOnReturn = false
- c3p0.acquireIncrement = 3
- c3p0.initialPoolSize = 3
- c3p0.idleConnectionTestPeriod = 900
- c3p0.minPoolSize = 2
- c3p0.maxPoolSize = 50
- c3p0.maxStatements = 100
- c3p0.numHelperThreads = 10
- c3p0.maxIdleTime = 600
- hibernate.dialect = org.hibernate.dialect.MySQLInnoDBDialect
- #hibernate.dialect = org.hibernate.dialect.MySQLMyISAMDialect
- hibernate.jdbc.batch_size = 25
- hibernate.jdbc.fetch_size = 50
- hibernate.show_sql = true
- hibernate.connection.release_mode = after_transaction
datasource.type = mysqldatasource.driverClassName = com.mysql.jdbc.Driverdatasource.url = jdbc:mysql://localhost: 3306 /test?useUnicode = true&characterEncoding = UTF- 8datasource.username = rootdatasource.password = 123456datasource.maxActive = 10datasource.maxIdle = 2datasource.maxWait = 120000datasource.whenExhaustedAction = 1datasource.validationQuery = select 1 from dualdatasource.testOnBorrow = truedatasource.testOnReturn = falsec3p0.acquireIncrement = 3c3p0.initialPoolSize = 3c3p0.idleConnectionTestPeriod = 900c3p0.minPoolSize = 2c3p0.maxPoolSize = 50c3p0.maxStatements = 100c3p0.numHelperThreads = 10c3p0.maxIdleTime = 600hibernate.dialect = org.hibernate.dialect.MySQLInnoDBDialect#hibernate.dialect = org.hibernate.dialect.MySQLMyISAMDialecthibernate.jdbc.batch_size = 25hibernate.jdbc.fetch_size = 50hibernate.show_sql = truehibernate.connection.release_mode = after_transaction
3) Spirng部分:為了清晰把Spring的配置檔案拆分成以下幾部分applicationContext-dao.xml、appliationContext-service.xml、applicationContext-hibernate.xml、action-servlet.xml。
applicationContext-hibernate.xml內容:
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- <beans>
- <bean id="propertyConfigurer"
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <!-- <value>WEB-INF/mail.properties</value>-->
- <value>WEB-INF/jdbc.properties</value>
- <!-- <value>WEB-INF/oscache.properties</value>-->
- </list>
- </property>
- </bean>
- <!-- MailSender used by EmailAdvice -->
- <!--
- <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
- <property name="host" value="${mail.host}"/>
- </bean>
- -->
- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
- destroy-method="close" dependency-check="none">
- <property name="driverClass">
- <value>${datasource.driverClassName}</value>
- </property>
- <property name="jdbcUrl">
- <value>${datasource.url}</value>
- </property>
- <property name="user">
- <value>${datasource.username}</value>
- </property>
- <property name="password">
- <value>${datasource.password}</value>
- </property>
- <property name="acquireIncrement">
- <value>${c3p0.acquireIncrement}</value>
- </property>
- <property name="initialPoolSize">
- <value>${c3p0.initialPoolSize}</value>
- </property>
- <property name="minPoolSize">
- <value>${c3p0.minPoolSize}</value>
- </property>
- <property name="maxPoolSize">
- <value>${c3p0.maxPoolSize}</value>
- </property>
- <property name="maxIdleTime">
- <value>${c3p0.maxIdleTime}</value>
- </property>
- <property name="idleConnectionTestPeriod">
- <value>${c3p0.idleConnectionTestPeriod}</value>
- </property>
- <property name="maxStatements">
- <value>${c3p0.maxStatements}</value>
- </property>
- <property name="numHelperThreads">
- <value>${c3p0.numHelperThreads}</value>
- </property>
- </bean>
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="dataSource">
- <ref local="dataSource" />
- </property>
- <property name="mappingResources">
- <list>
- <value>com/firstssh/model/User.hbm.xml</value>
- </list>
- </property>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">${hibernate.dialect}</prop>
- <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
- <prop key="hibernate.jdbc.fetch_size">
- ${hibernate.jdbc.fetch_size}
- </prop>
- <prop key="hibernate.jdbc.batch_size">
- ${hibernate.jdbc.batch_size}
- </prop>
- </props>
- </property>
- </bean>
- <!-- 配置事務管理器bean,使用HibernateTransactionManager事務管理器 -->
- <bean id="transactionManager"
- class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <!-- 為事務管理器注入sessionFactory" -->
- <property name="sessionFactory" ref="sessionFactory"/>
- </bean>
- <!-- 配置事務攔截器Bean -->
- <bean id="transactionInterceptor"
- class="org.springframework.transaction.interceptor.TransactionInterceptor">
- <!-- 為事務攔截器bean注入一個事物管理器 -->
- <property name="transactionManager" ref="transactionManager"></property>
- <property name="transactionAttributes">
- <!-- 定義事務傳播屬性 -->
- <props>
- <prop key="insert*">PROPAGATION_REQUIRED</prop>
- <prop key="update*">PROPAGATION_REQUIRED</prop>
- <prop key="save*">PROPAGATION_REQUIRED</prop>
- <prop key="add*">PROPAGATION_REQUIRED</prop>
- <prop key="remove*">PROPAGATION_REQUIRED</prop>
- <prop key="delete*">PROPAGATION_REQUIRED</prop>
- <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
- <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
- <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
- <prop key="change*">PROPAGATION_REQUIRED</prop>
- <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
- </props>
- </property>
- </bean>
- <!-- 定義BeanNameAutoProxyCreator -->
- <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
- <!-- 指定滿足哪些bean自動生成業務代理 -->
- <property name="beanNames">
- <!-- 需要自動建立事務代理的bean -->
- <list>
- <value>userService</value>
- </list>
- <!-- 其它需要自動建立事務代理的bean -->
- </property>
- <property name="interceptorNames">
- <list>
- <value>transactionInterceptor</value>
- <!-- 可增加其它的interceptor -->
- </list>
- </property>
- </bean>
- </beans>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"><beans><bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <!-- <value>WEB-INF/mail.properties</value>--> <value>WEB-INF/jdbc.properties</value> <!-- <value>WEB-INF/oscache.properties</value>--> </list> </property></bean><!-- MailSender used by EmailAdvice --><!-- <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host" value="${mail.host}"/> </bean>--><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" dependency-check="none"> <property name="driverClass"> <value>${datasource.driverClassName}</value> </property> <property name="jdbcUrl"> <value>${datasource.url}</value> </property> <property name="user"> <value>${datasource.username}</value> </property> <property name="password"> <value>${datasource.password}</value> </property> <property name="acquireIncrement"> <value>${c3p0.acquireIncrement}</value> </property> <property name="initialPoolSize"> <value>${c3p0.initialPoolSize}</value> </property> <property name="minPoolSize"> <value>${c3p0.minPoolSize}</value> </property> <property name="maxPoolSize"> <value>${c3p0.maxPoolSize}</value> </property> <property name="maxIdleTime"> <value>${c3p0.maxIdleTime}</value> </property> <property name="idleConnectionTestPeriod"> <value>${c3p0.idleConnectionTestPeriod}</value> </property> <property name="maxStatements"> <value>${c3p0.maxStatements}</value> </property> <property name="numHelperThreads"> <value>${c3p0.numHelperThreads}</value> </property></bean><bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource" /> </property> <property name="mappingResources"> <list> <value>com/firstssh/model/User.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.jdbc.fetch_size"> ${hibernate.jdbc.fetch_size} </prop> <prop key="hibernate.jdbc.batch_size"> ${hibernate.jdbc.batch_size} </prop> </props> </property></bean><!-- 配置事務管理器bean,使用HibernateTransactionManager事務管理器 --><bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <!-- 為事務管理器注入sessionFactory" --> <property name="sessionFactory" ref="sessionFactory"/></bean><!-- 配置事務攔截器Bean --><bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <!-- 為事務攔截器bean注入一個事物管理器 --> <property name="transactionManager" ref="transactionManager"></property> <property name="transactionAttributes"> <!-- 定義事務傳播屬性 --> <props> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="remove*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="change*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property></bean><!-- 定義BeanNameAutoProxyCreator --><bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <!-- 指定滿足哪些bean自動生成業務代理 --> <property name="beanNames"> <!-- 需要自動建立事務代理的bean --> <list> <value>userService</value> </list> <!-- 其它需要自動建立事務代理的bean --> </property> <property name="interceptorNames"> <list> <value>transactionInterceptor</value> <!-- 可增加其它的interceptor --> </list> </property></bean></beans>
applicationContext-dao.xml內容:
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- <beans>
- <!-- 根DAO -->
- <bean id="genericDao" class="com.firstssh.common.dao.GenericDao">
- <property name="sessionFactory">
- <ref bean="sessionFactory" />
- </property>
- </bean>
- <bean id="userDao" class="com.firstssh.dao.impl.UserDao" parent="genericDao" />
- </beans>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"><beans><!-- 根DAO --><bean id="genericDao" class="com.firstssh.common.dao.GenericDao"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property></bean><bean id="userDao" class="com.firstssh.dao.impl.UserDao" parent="genericDao" /></beans>
applicationContext-service.xml內容:
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- <beans>
- <bean id="userService" class="com.firstssh.service.impl.UserService">
- <property name="userDao">
- <ref bean="userDao"/>
- </property>
- </bean>
- <bean id="validateName" class="com.firstssh.common.Bean.ValidateName">
- <property name="userService">
- <ref local="userService"/>
- </property>
- </bean>
- </beans>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"><beans><bean id="userService" class="com.firstssh.service.impl.UserService"> <property name="userDao"> <ref bean="userDao"/> </property></bean><bean id="validateName" class="com.firstssh.common.Bean.ValidateName"> <property name="userService"> <ref local="userService"/> </property></bean></beans>
action-servlet.xml內容:
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- <beans>
- <bean id="LoginAction" class="com.firstssh.action.LoginAction"
- scope="prototype">
- <property name="userService" ref="userService" />
- </bean>
- <bean id="RegistAction" class="com.firstssh.action.RegistAction"
- scope="prototype">
- <property name="userService" ref="userService" />
- </bean>
- </beans>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"><beans> <bean id="LoginAction" class="com.firstssh.action.LoginAction" scope="prototype"> <property name="userService" ref="userService" /> </bean> <bean id="RegistAction" class="com.firstssh.action.RegistAction" scope="prototype"> <property name="userService" ref="userService" /> </bean></beans>
以上幾個xml檔案的內容暫且不要理會,繼續往下看,你就自動明白的,不用我解釋。
4)日誌部分:log4j.properties 、commons-logging.properties
log4j.properties內容:
- # For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!
- # For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.
- log4j.rootLogger=INFO, stdout, logfile
- log4j.appender.stdout=org.apache.log4j.ConsoleAppender
- log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
- log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
- log4j.appender.logfile=org.apache.log4j.RollingFileAppender
- log4j.appender.logfile.File=${firstssh.root}/WEB-INF/logs/firstssh.log
- log4j.appender.logfile.MaxFileSize=512KB
- # Keep three backup files.
- log4j.appender.logfile.MaxBackupIndex=3
- # Pattern to output: date priority [category] - message
- log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
- log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
- # OpenSymphony Stuff
- log4j.logger.com.opensymphony=INFO
- log4j.logger.org.apache.struts2=INFO
- # Spring Stuff
- log4j.logger.org.springframework=INFO
- # Hibernate Stuff
- log4j.logger.org.hiberante=INFO
# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.log4j.rootLogger=INFO, stdout, logfilelog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%nlog4j.appender.logfile=org.apache.log4j.RollingFileAppenderlog4j.appender.logfile.File=${firstssh.root}/WEB-INF/logs/firstssh.loglog4j.appender.logfile.MaxFileSize=512KB# Keep three backup files.log4j.appender.logfile.MaxBackupIndex=3# Pattern to output: date priority [category] - messagelog4j.appender.logfile.layout=org.apache.log4j.PatternLayoutlog4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n# OpenSymphony Stufflog4j.logger.com.opensymphony=INFOlog4j.logger.org.apache.struts2=INFO# Spring Stufflog4j.logger.org.springframework=INFO# Hibernate Stufflog4j.logger.org.hiberante=INFO
commons-logging.properties
內容:
- org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JLogger
org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JLogger
5)web.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
- <display-name>firstssh</display-name>
- <description>this is a simple example</description>
- <context-param>
- <param-name>webAppRootKey</param-name>
- <param-value>firstssh.root</param-value>
- </context-param>
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/applicationContext-*.xml,/WEB-INF/action-servlet.xml</param-value>
- </context-param>
- <context-param>
- <param-name>log4jConfigLocation</param-name>
- <param-value>/WEB-INF/log4j.properties</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>
- <!-- 定義整合SiteMesh必須的ActionContextCleanUp Filter
- <
相關文章
- SSH框架整合步驟薦框架
- ssh整合步驟之一(搭建環境)
- jafka環境搭建步驟--例項可用
- SSH框架學習步驟框架
- SSH框架總結(框架分析+環境搭建+例項原始碼下載)框架原始碼
- SpringMVC框架搭建步驟SpringMVC框架
- 【SSH2(實踐篇)】--Struts2檔案上傳下載例項
- struts2 + urlrewrite 整合注意事項
- ssh整合步驟之二(架構設計)架構
- Mybatis原始碼解析2—— 例項搭建MyBatis原始碼
- struts2 使用Maven搭建Struts2框架的開發環境Maven框架開發環境
- SSH框架整合框架
- Struts2教程1:第一個Struts2程式
- JavaScript運動框架程式碼例項JavaScript框架
- SSH框架整合配置所需JAR包(SSH整合)框架JAR
- ORACLE11GR2 RAC解除安裝ASM例項步驟OracleASM
- 自己理解的例項恢復步驟
- SSH框架搭建詳細圖文教程(轉)框架
- Smarty例項教程(2)
- Spring+SpringMvc+Mybatis框架整合搭建教程三(框架整合測試程式開發)SpringMVCMyBatis框架
- struts2框架搭建學習遇到的問題框架
- .Net Core Web Api 框架搭建詳細步驟WebAPI框架
- .Net Core Web Api 框架搭建簡單步驟WebAPI框架
- 測試框架 Mocha 例項教程框架
- SSH框架查詢方法(struts2 Spring 3.1 Hibernate 4.1)框架Spring
- Struts2工程搭建
- spring整合struts2Spring
- Struts2的框架框架
- 框架(Spring、Struts2和Hibernate三者)整合框架Spring
- MHA搭建步驟
- Allure2新增用例標題、用例步驟
- 11g 兩個節點RAC 搭建單例項DG詳細步驟以及注意事項單例
- Git 中 SSH key 生成步驟Git
- Oracle資料庫例項啟動步驟分析Oracle資料庫
- loadrunner負載測試例項(含步驟)負載
- Axis2+spring整合例項Spring
- 「SSM框架最新專案」搭建個人部落格例項講解教程SSM框架
- struts2驗證+攔截器+國際化+下載excle文件+struts2二級聯動+OGNL表達試+ssh整合\部分程式碼, 專案下載、