Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
 
 
Search All Tutorials

 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 
Struts
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

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.

                         

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

11 comments so far (post your own) View All Comments Latest 10 Comments:

Hi
Thanks for this interesting tutorial !!
I can't uncompress the project.zip, the file is corrupt.
please check href links...

Thanks in advance !!
Doxumd

Posted by doxumd on Wednesday, 02.6.08 @ 15:28pm | #47408

It is really helpful for quick learning.

Posted by Raghu on Thursday, 11.29.07 @ 16:14pm | #40886

Hi ,
Can you tell me how to run this application on MyEclipse .

CAn you provide me a Login application only of Struts and database combination.

Posted by Pankaj on Sunday, 11.18.07 @ 10:05am | #37686

Deepak,

I have the app working on Weblogic, but I get the error below when trying to login with an invalid username. Any thoughts?

java.lang.NoSuchMethodError: com.mycompany.work.web.struts.action.UserLoginAction.saveErrors(Ljavax/servlet/http/HttpServletRequest;Lorg/apache/struts/action/ActionMessages;)V
at com.mycompany.work.web.struts.action.UserLoginAction.execute(Unknown Source)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:223)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3245)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2003)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1909)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

Posted by Gary on Friday, 09.28.07 @ 00:42am | #30099

How different are the deploy steps to get this running on weblogic server?

Posted by Gary on Wednesday, 09.19.07 @ 19:48pm | #27862

sir i have not downloaded this code

Posted by surya on Saturday, 08.4.07 @ 17:22pm | #22652

notes is good fr learnimg see thi

Posted by naresh on Tuesday, 07.17.07 @ 12:10pm | #21424

There are several broken links. Please check the accordingly.

Thanks,
Akash

Posted by Akash Borkar on Friday, 12.1.06 @ 14:49pm | #321

Hi,

The correct file is http://www.roseindia.net/struts/hibernate-spring/project.zip

I have updated the page. Thanks for pointing out the boken link issue.

Deepak

Posted by Deepak Kumar on Wednesday, 11.29.06 @ 21:03pm | #207

Hi Deepak,

The struts-spring-hibernate.zip is not accessible. I hope it can be fixed as soon as possible.

Thank you.

Posted by newbie on Wednesday, 11.29.06 @ 20:06pm | #206

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Hot Web Programming Job

Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.