`

ssh 的 整合方案

阅读更多
web.xml:
可以把<property name="annotatedClasses"> 
改成
<property name="packagesToScan">
<list>
<value>com.***.***</value>
</list>
</property>

<?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">
  	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext.xml</param-value>
	</context-param>

	<!-- 连接池自带监控程序 -->
	<servlet>
		<servlet-name>ProxoolAdmin</servlet-name>
		<servlet-class>
			org.logicalcobwebs.proxool.admin.servlet.AdminServlet
		</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>ProxoolAdmin</servlet-name>
		<url-pattern>/ProxoolAdmin.svl</url-pattern>
	</servlet-mapping>


	<filter>
		<filter-name>encodingFilter</filter-name>
		<filter-class>com.community.interceptor.EncodingFilter</filter-class>
		<init-param>
			<param-name>encoding</param-name>
			<param-value>UTF-8</param-value>
		</init-param>
	</filter>
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>
			org.apache.struts2.dispatcher.FilterDispatcher
		</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>encodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>	
	

	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>
	<!-- Spring 刷新Introspector防止内存泄露 -->
	<listener>
		<listener-class>
			org.springframework.web.util.IntrospectorCleanupListener
		</listener-class>
	</listener>
	
	<!-- 容器监听器便于清零服务器异常中断导致错误的用户登录状态 -->
	<listener>
		<listener-class>com.community.interceptor.WebContainerListener</listener-class>
	</listener>
	<!-- session监听器,便于用户session超时清零用户登录状态 -->
	<listener>
		<listener-class>com.community.interceptor.SessionListener</listener-class>
	</listener>

	<servlet>
	        <servlet-name>Kaptcha</servlet-name>
	        <servlet-class>com.google.code.kaptcha.servlet.KaptchaServlet</servlet-class>
	        <init-param>
			    <param-name>kaptcha.textproducer.char.string</param-name>
			    <param-value>abcde2345678gfynmnpwx2345678ABCDEGFYNMNPWX</param-value>
			</init-param>
			 <init-param>
			    <param-name>kaptcha.textproducer.font.size</param-name>
			    <param-value>45</param-value>
			</init-param>
			
			 <init-param>
			    <param-name>kaptcha.textproducer.char.length</param-name>
			    <param-value>5</param-value>
			</init-param>			
			<init-param>
			    <param-name>kaptcha.image.width</param-name>
			    <param-value>200</param-value>
			</init-param>
			<init-param>
			    <param-name>kaptcha.image.height </param-name>
			    <param-value>50</param-value>
			</init-param>
			<init-param>
			    <param-name>kaptcha.textproducer.font.color </param-name>
			    <param-value>204,139,193</param-value>
			</init-param>
			<init-param>
			    <param-name>kaptcha.noise.color  </param-name>
			    <param-value>204,139,193</param-value>
			</init-param>
			<init-param>
			    <param-name>kaptcha.background.clear.from </param-name>
			    <param-value>white</param-value>
			</init-param>
			<init-param>
			    <param-name>kaptcha.background.clear.to </param-name>
			    <param-value>white</param-value>
			</init-param>			 
	</servlet>
	<servlet-mapping>
	        <servlet-name>Kaptcha</servlet-name>
	        <url-pattern>/kaptcha.jpg</url-pattern>
	</servlet-mapping>
	

	<!-- session超时定义,单位为分钟 -->
	<session-config>
		<session-timeout>100</session-timeout>
	</session-config>
	
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>
</web-app>



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:jee="http://www.springframework.org/schema/jee" 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-2.5.xsd
					http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
					http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
					http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
	default-lazy-init="true">

	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    	<property name="location">
    		<value>classpath:jdbc.properties</value>
    		<!--
			<value>/WEB-INF/jdbc.properties</value>
			-->
		</property>
	</bean>	
	<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource">		
		<property name="driver" value="${db.driver}"/>
		<property name="driverUrl" value="${db.url}"/>
		<property name="user" value="${db.user}"/>
		<property name="password" value="${db.password}"/>
    	<property name="alias" value="${db.alias}"/>
    	<property name="houseKeepingTestSql" value="${db.houseKeepingTestSql}"/>
    	<property name="maximumConnectionCount" value="${db.maximumConnectionCount}"/>
    	<property name="minimumConnectionCount" value="${db.minimumConnectionCount}"/>
	</bean>

	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">   
        <!-- 引用数据源 -->   
        <property name="dataSource">   
            <ref bean="dataSource" />   
        </property>                 
        <property name="annotatedClasses">   
            <list>    
             	<value>com.community.entity.ClubCity</value>            	
                <value>com.community.entity.ClubOwnerUser</value>             
                <value>com.community.entity.ClubUser</value>
                <value>com.community.entity.ClubDealer</value>
                <value>com.community.entity.ClubProvince</value>
                <value>com.community.entity.ClubMember</value>
                <value>com.community.entity.ClubExpert</value>
                <value>com.community.entity.ClubExpertTips</value>
                <value>com.community.entity.ClubNews</value>
                <value>com.community.entity.ClubNewsEntry</value>
                <value>com.community.entity.ClubNewsTags</value>
                <value>com.community.entity.ClubNewsType</value>
                <value>com.community.entity.ClubTipsTag</value>
                <value>com.community.entity.ClubTipsType</value>
                <value>com.community.entity.FordCar</value>
                <value>com.community.entity.FordClubMember</value>
                <value>com.community.entity.ForumAccess</value> 
                <value>com.community.entity.ForumDating</value> 
                <value>com.community.entity.ForumDegreeDescription</value> 
                <value>com.community.entity.ForumFolder</value>
                <value>com.community.entity.ForumFriend</value> 
                <value>com.community.entity.ForumGradeSwap</value> 
                <value>com.community.entity.ForumGroupFriend</value> 
                <value>com.community.entity.ForumInformation</value> 
                <value>com.community.entity.ForumLoginUser</value>
                <value>com.community.entity.ForumMainModule</value> 
                <value>com.community.entity.ForumMessage</value> 
                <value>com.community.entity.ForumModerator</value> 
                <value>com.community.entity.ForumModule</value> 
                <value>com.community.entity.ForumPosts</value> 
                <value>com.community.entity.ForumRankRolus</value> 
                <value>com.community.entity.ForumReplicationMessage</value> 
                <value>com.community.entity.ForumReplyThread</value> 
                <value>com.community.entity.ForumSignature</value> 
                <value>com.community.entity.ForumSpeak</value> 
                <value>com.community.entity.ForumThread</value> 
                <value>com.community.entity.ForumUserModule</value> 
                <value>com.community.entity.ForumUserRank</value> 
                <value>com.community.entity.ForumMd5pwd</value>
            </list>   
        </property> 
        <property name="hibernateProperties">   
            <props>   
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>   
                <prop key="hibernate.show_sql">false</prop>   
                <prop key="hibernate.format_sql">false</prop>            
                <prop key="hibernate.jdbc.fetch_size">20</prop> 
                <prop key="hibernate.query.substitutions">true 1, false 0</prop> 
                <prop key="hibernate.jdbc.batch_size">20</prop>  
                <prop key="hibernate.cache.use_structured_entries">true</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop> 
                <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
                <prop key="hibernate.cache.provider_configuration_file_resource_path"></prop>                                    
            </props>   
         </property>               
    </bean>   

	
	<!-- 事务配置 -->
	<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<!-- 使用annotation 自动注册bean,并检查@Required,@Autowired的属性已被注入 -->
	<context:annotation-config/> 
	<context:component-scan base-package="com.community" />
	
	<!-- 使用annotation定义事务 -->
	<tx:annotation-driven transaction-manager="txManager" />
	</beans>


jdbc.properties:
db.driver=oracle.jdbc.driver.OracleDriver
db.url=jdbc:oracle:thin:@172.16.22.10:1521:crm
db.user=crm
db.password=p
db.alias=OraclePool
db.houseKeepingTestSql=select 1
db.characterEncoding=GBK
db.maximumConnectionCount=30
db.minimumConnectionCount=5


struts.properties:
这个我不是太熟悉
struts.devMode = true
struts.configuration.xml.reload=true
struts.i18n.encoding=UTF-8
struts.action.extension=do,action  
#struts.locale=en_us
struts.custom.i18n.resources=com/club/res/globalMessages
struts.objectFactory =spring 
struts.multipart.maxSize=8388608
struts.enable.DynamicMethodInvocation=false
struts.enable.SlashesInActionNames=true


struts.xml:
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
        "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
	<package name="default" extends="struts-default">
		<interceptors>
			<interceptor name="singleLoginInterceptor"
				class="com.community.interceptor.SingleLoginInterceptor">
			</interceptor>
			<interceptor name="sessionTimeoutInterceptor" class="com.community.interceptor.SessionTimeoutInterceptor" />
			<interceptor name="checkCookieInterceptor" class="com.community.interceptor.CheckCookieInterceptor" />
		</interceptors>
		<global-results>
			<result name="timeout" type="redirect" >timeoutMsg.jsp</result>
		</global-results>
	</package>
	
	<package name="struts2ajax" extends="json-default">

	</package>
</struts>

分享到:
评论

相关推荐

    SSH框架整合图解(3个方案)

    SSH框架整合图解(3个方案)SSH框架整合图解(3个方案)SSH框架整合图解(3个方案)SSH框架整合图解(3个方案)SSH框架整合图解(3个方案)SSH框架整合图解(3个方案)SSH框架整合图解(3个方案)SSH框架整合图解(3...

    SSH整合遇到的问题及解决方案

    ssh整合时遇到的问题,里面详细的描述整合时所产生的问题,经过精细挑选,将一些经典实例整合在一起.

    简单的SSH整合示例——用户登录功能

    简单的SSH整合示例——用户登录功能,里面包含一个完整的示例和我遇到的一些问题的解决方案。欢迎下载、

    ssh比较详细的整合配置方案

    ssh比较详细的整合配置方案,教你一步一步实现ssh的配置功能

    ext+ssh代码和整合方案

    ssh+ext代码和整合方案

    MyEclipse的SSH整合配置方案.rar

    讲得非常详细的SSH整合教程,不会让你失望的

    SSH全注解整合demo

    整合使用最新版本的三大框架(即Struts2、Spring4和Hibernate4),演示搭建项目架构原型。 项目架构原型:Struts2.3.16+Spring4.1.1+Hibernate4.3.6。 此外,还有:log4j、slf4j、ehcache等知识点。 参考文档:...

    SSH整合开发环境搭建的一种解决方案

    SSH整合开发环境搭建的一种解决方案

    SSH+Freemarker整合

    SSH+Freemarker 的整合方案最小项目案例

    SSH和Jbpm4.4

    jbpm+ssh整合方案,带jar包。支持oracel数据库

    Java web SSH框架整合开发

    详细的讲解了如何用struts2 spring hibernate 开发一个项目 包含开发文档,数据库备份 和源代码。直接部署后即可运行的小项目 关于部署后出现的问题 基本在开发文档中都有提出解决方案。

    activemq实战项目,同ssh框架整合(生产者+消费者)

    一套完整的activemq生产者、消费者。同shh整合开发完整的项目。注释清楚,包括activemq的消息重试,重复消费等解决方案。可供新手学习使用。

    ssh三大框架整合方案

    手把手叫你整合三大框架,采用最新的spring3.0,strust2 2.3,hibernate3.6进行整合的。适合新手学习。

    ssh框架整合讲解

    最近整合SSH框架,期间遇到很多问题,中途几次熬夜查找,精神几度崩溃,心想如此好的框架为啥搭建整合的时候确实如此费劲,在网上找了很多解决方案,均不能解决问题。为了以后让想学SSH的人少走点弯路,故此次将整个完整...

    UeditorModel-SSH-方案1.rar

    SSH框架中整合了百度编译器,打开可以直接使用, 百度编译器ueditor在SSH(struts2)中出现上传错误,未找到上传数据的两种解决方案,其中一种依旧使用struts2的过滤器 这个使用的是方案1,访问百度编译器的端口直接...

    UeditorModel-SSH-方案2.rar

    SSH框架中整合了百度编译器,打开可以直接使用, 这个使用的是方案2,访问百度编译器的端口直接经过Struts2,重写controller.jsp实现 Struts2的默认拦截器可以起作用, 想了解更多访问...

    SSH整合文档教程…………

    Struts2+Spring+Hibernate是J2EE的最新流行框架。本篇是我搭建这个框架的经验...大大小小的问题,网上也没有什么行之有效的方案或成体系的介绍,所以我就决定总结一下我的搭建过程。给一些搭 建尚存问题的朋友提供帮助

Global site tag (gtag.js) - Google Analytics