Brief Introduction to Spring (8) SSH integration and springssh Integration
1. Integration of Spring and Struts2 1.1. Integration steps
1.2 configure web. xml
1.3 configure the spring configuration file applicationContext. xml
1.4 configure the struts configuration file
1.5. Action inherits the ActionSupport class
Ii. Integration of spring and hibernate 2.1 steps
2.2 inject sessionFactory
<-- Data source --> <bean id = "dataSource" class = "org. springframework. jdbc. datasource. driverManagerDataSource "> <-- or class =" org. apache. commons. dbcp. basicDataSource "--> <-- or class =" org. apache. commons. dbcp. basicDataSource "--> <-- driver --> <property name =" driverClassName "value =" oracle. jdbc. driver. oracleDriver "/> <-- url --> <property name =" url "value =" jdbc: oracle: thin: @ localhost: 1521: orcl "/> <-- User name --> <property name =" username "value =" accp "/> <-- password --> <property name =" password "vaule =" accp" /> </bean> <-- sessionFactory --> <bean id = "session" class = "org.springframework.org. hibernate3.LocalSessionFacotry "> <-- associate data source --> <property name =" dataSource "ref =" dataSource "/> <-- Some hibernate configurations-> <property name =" hibernateProperties "> <props> <prop key = "hibernate. dialect "> org. hibernate. dialect. oracle9Dialect </prop> </props> </property> <-- hibernate object class Configuration File> <property name = "mappingResources"> <list> <value> package name/Class name. hbm. xml </value> <value> package name/class name. hbm. xml </value> <list> </property> <bean>
Iii. SSH integration steps
/** 1. import struts2 jar package and struts2-spring-plugin-2.0.11.2.jar * 2. in the web. configure struts2 and spring information in xml respectively. the original Action in struts must inherit ActionSupport * 4. configure Action Bean * 5 in Spring. in the Struts2 configuration file, call the Bean * 6 configured in Spring. spring and Hibernate integration, you only need to configure SessionFactory in the Spring configuration file */