integrate struts2 ,spring and hibernate. Configuration

Commonly used J2EE server side frameworks.

integrate struts2 ,spring and hibernate. Configuration

Postby haretu » Fri Mar 18, 2011 9:07 pm

the summary of integration steps :

    Get all the dependency libraries (a lot).
    Register Spring’s ContextLoaderListener to integrate Struts 2 and Spring.
    Use Spring’s LocalSessionFactoryBean to integrate Spring and Hibernate.
    Done, all connected.

Insert in web.xml
Code: Select all
   <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>classpath:/applicationContext.xml</param-value>
     </context-param>
 
  <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


in struts.xml insert
Code: Select all
     <constant name="struts.objectFactory" value="spring" />


in applicationContext.xml insert
Code: Select all
<bean id="SessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource">
         <ref bean="dataSource" />
      </property>
      <property name="mappingResources">
            <list>
                 <value>......
......
haretu
 
Posts: 132
Joined: Sat Jan 08, 2011 9:56 pm

Return to struts,spring,hibernate

Who is online

Users browsing this forum: No registered users and 0 guests

cron