Home Struts Hibernate-spring Integrate Struts, Hibernate and Spring
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Integrate Struts, Hibernate and Spring

Advertisement
In this section you will learn how to download required software for our Login and Registration Application. In this tutorial we are using one of the best technologies (Struts, Hibernate and Spring). This tutorial is very good if you want to learn the pro

Integrate Struts, Hibernate and Spring

     

In this section you will learn how to download required software for our Login and Registration Application. In this tutorial we are using one of the best technologies (Struts, Hibernate and Spring). This tutorial is very good if you want to learn the process of integrating these technologies in your application and developed highly scalable and robust web application.

Download Struts:

The latest version of Struts can be downloaded from
http://struts.apache.org/download.cgi. We are using Struts version

Download Hibernate:

The latest version of Hibernate can be downloaded from 
http://www.hibernate.org/6.html
. We are using hibernate-3.1.3 for this tutorial.

Download Spring:

The latest version of Spring Framework can be downloaded from 
http://www.springframework.org/download
. We are using spring-framework-1.2.8-with-dependencies for this tutorial.

Setting up Development Directory:

Development directory is very important for any project. It helps you organize all the software components to make the development process easy. In the web development process you make changes to the program and then compile, package and deploy on the application on the application server. Once the application is deployed you test the effect of your changes. This is repetitive task in the programming, so its is very important to have good directory structure that helps you reduce the time taken in compilation and deployment process. In our application we are using tomcat server. Here are the process to integrate all the components and then compile and test your development directory structure. If you don't want to waste the time in setting up the directory structure you can download the full application from our website. To download the code click here.

  1.  Extract "struts-blank.war" into copy the directory "struts-blank" to "integrated\src" and rename the directory struts-blank to project.
      
  2. Copy all the files from "spring-framework-1.2.8-with-dependencies\spring-framework-1.2.8\dist" into "\integrated\src\project\WEB-INF\lib".
      
  3. Copy hibernate3.jar from hibernate-3.1.3\hibernate-3.1 into \integrated\src\project\WEB-INF\lib.
      
  4. Copy all the files from "hibernate-3.1.3\hibernate-3.1\lib" into "integrated\src\project\WEB-INF\lib".
      
  5. Download "applicationContext-hibernate.xml" and "jdbc.properties" files and then place in the
    "integrated\src\project\WEB-INF\" folder.
      
  6. Modify the "jdbc.properties" and change the following parameters for your database:
    jdbc.driverClassName=com.mysql.jdbc.Driver
    jdbc.url=jdbc:mysql://192.168.10.3:3306/strutshibernatespring
    jdbc.username=deepak
    jdbc.password=deepak
      
  7. Create an directory "libext" under "project\WEB-INF\". This directory will be used in our project to place the library files that which will used to compile the java classes. For compiling Servlets we need the Servlet, so you find "servlet-api.jar" from you tomcat server and copy in "libext" directory.
     
  8. Download "build.xml" file and replace the "build.xml" file present in "project\WEB-INF\src" directory.
      
  9. In the build.xml file you can change the jar file name for your application by changing the following value:
    <property name="project.jar.file" value="project.jar"/>
    When you run ant compile from command prompt, all the java files will be compiled and a jar file is created and placed in the lib directory.
     
  10. Now copy the project directory to webapps directory of your tomcat server.
      
  11. Start the tomcat and type http://localhost:8080/project in browser. Your browser should show the default welcome page that comes with struts-blank application.
      

In this section you have setup the directory structure for your web application and tested on the tomcat server.

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 18, 2008

Ask Questions?    Discuss: Integrate Struts, Hibernate and Spring   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Hendrik
May 16, 2012
build.xml

Hi, I cannot download build.xml. could you please fix the link? Regards, Hendrik
DMCA.com