Brief Introduction to SSH integration 1. Brief Introduction to SSH integration

Source: Internet
Author: User

Brief Introduction to SSH integration 1. Brief Introduction to SSH integration
1. Configure in web. xml

Struts2 filter <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> added spring context configuration <context-param> <param-name> contextConfigLocation </param-name> <param-value> classpath: applicationContext. xml </param-value> <context-param> adds a listener <listener> <listener-class> org. springframework. web. context. contextLoaderListener </listerner-class> </listener>

 

2. Configure in applicationContext. xml
ApplicationContext. the data source configuration in xml can be changed to another data source <bean id = "dataSource" class = "org. apache. commons. dbcp. basicDataSource "> property driver <property name =" driverClassName "value =" oracle. jdbc. driver. oracleDriver "/> connection URL <property name =" url "value =" jdbc: oracle: thin :@ localhost: 1521: orcl "/> username <property name =" username "value =" accp "/> password <property name =" password "value =" accp "/> </bean> Configure sessionFactory <bean id = "sessionFactory" class = "org. springframework. orm. hibernate3.LocalSessionFactoryBean "> associated data source <property name =" dataSource "ref =" dataSource "/> Configure the attributes of hibernate <property name =" hibernateProperties "> <props> to connect to the dialect of the database. different data and versions depend on <prop key = "hibernate. dialect "> org. hibernate. dialect. oracle9Dialect </prop> </props> </property> ing file configuration <property name = "mappingResources"> <list> <value> hibernate configuration file path/Class name of the implementation class. hbm. cfg </value> </list> </property> </bean>

 

3. Configure in struts. xml

After configuring the struts action in applicationContext. xml
In struts. xml, the action class should write the id of the struts action configured in applicationContext. xml.

The above operations may be wrong and configured as needed

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.