SSH Framework Integration process

Source: Internet
Author: User
Tags aop ssh

SSH Framework Configuration Process---------
The first step: Add the configuration in the Web. xml file, in order to load the Applicationcontext.xml file, here is the default load
<listener>
<listener-class>
Org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

2nd Step: Configure the following in the Struts-config.xml file: To load the Action.xml file when loading Struts-config.xml
The Action.xml file is loaded when the file is read to the <plug-in> tab
<action path= "/xxx" type= "Org.springframework.web.struts.DelegatingActionProxys" >
</action>

<plug-in classname= "Org.springframework.web.struts.ContextLoaderPlugIn" >
<set-property property= "contextconfiglocation" value= "/web-inf/action.xml"/>
</plug-in>

3rd Step: Configure the Spring type file Hibernate.xml
<!--Configuring the data source datasource-->
<bean id= "ds" class= "Org.apache.commons.dbcp.BasicDataSource" >
<property name= "url" value= "Jdbc:mysql://localhost:3306/web"/>
<property name= "Driverclassname" value= "Com.mysql.jdbc.Driver"/>
<property name= "username" value= "root"/>
<property name= "password" value= ""/>
</bean>
<!--Configure sessionfactory with spring-provided thread-safe class--
<bean id= "SF"
class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name= "DataSource" >
<ref bean= "ds"/>
</property>
<property name= "Mappingresources" >
<list>
<value>
XXX.hbm.xml
</value>
</list>
<property name= "Hibernateproperties" >
<props>
<prop key= "Hibernate.dialect" >
Org.hibernate.dialect.MySQLDialect
</prop>
<prop key= "Hibernate.show_sql" >true</prop>
</props>
</property>
<!--configuration Transaction Management TransactionManager
<bean id= "TX"
class= "Org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name= "Sessionfactory" >
<ref bean= "SF" ></ref>
</property>
</bean>
<!--configuring Hibernate Template---
<bean id= "Hibernatetemplate" class= "Org.springframework.orm.hibernate3.HibernateTemplate" >
<property name= "Sessionfactory" >
<ref bean= "SF"/>
</property>
</bean>

4th Step: Configure the Spring-type Dao.xml file
<bean id= "xxx" class= "xx.xxx" >
<property name= "xxxx" ref= "xxx"/>
</bean>
S
5th step: Configure the Spring-type Service.xml file
<!--management advice--> of configuration transactions
<tx:advice id= "Txadivce" transaction-manager= "TX" >
<tx:attributes>
<tx:method name= "get*" read-only= "true"/>
<tx:method name= "add*" propagation= "REQUIRED"/>
<tx:method name= "delete*" propagation= "REQUIRED"/>
</tx:attributes>
</tx:advice>
Advisor--> of <!--configuration transactions
<aop:config>
<aop:advisor pointcut= "Execution (* palace.service.*.* (..))"
advice-ref= "Txadivce"/>
</aop:config>
After the configuration is basically completed SSH integration, not good summary but I hope to help you

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.