Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Downloading Struts & Hibernate
In this we will download Struts & Hibernate and setup the development environment.
 
Search Tutorials:
 
Software Solutions and Services
 

 
Google Custom Search:
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation

Downloading Struts & Hibernate

                         

In this we will download Struts & Hibernate and setup the development environment.

Downloading Hibernate

Hibernate is free open source software it can be download from http://www.hibernate.org/. Visit http://www.hibernate.org/ and then click on the Download link to go to the download page. From the download page download the current latest release of Hibernate Core. For this tutorial I have downloaded Hibernate hibernate-3.1.1.zip.

Download Struts

The latest release of Struts can be downloaded from http://struts.apache.org/download.cgi. For this tutorial I have download struts-1.2.9-bin.zip. Save downloaded file into your hard disk.

Downloading Ant

Ant is a free tool under GNU Licence and is freely available at http://jakarta.apache.org/ant/ , current version of ant is 1.6.5. Ant allows the developer to automate the repeated process involved in the development of J2EE application. Developers can easily write the script to automate the build process like compilation, archiving and deployment. For this tutorial I am using apache-ant-1.6.5.

Download MySQL JDBC Driver
Download mysql-connector-java-3.0.16-ga-bin.jar from here mysql-connector-java-3.0.16-ga-bin.jar or you can download and use the latest version of mysql jdbc driver. Copy the JDBC driver file (mysql-connector-java-3.0.16-ga-bin.jar or latest version) to the jakarta-tomcat-5.5.9\common\lib directory of your tomcat installation. This will add the MySQL JDBC driver to the tomcat server.

Setting Up Development Environment

First we will create necessary directories and moved the required files to the appropriate directory. Follow the following steps to accomplish this:

  1. Create a directory in you c: drive called Struts-Hibernate-Integration.
      
  2. Unzip Downloaded file in the directory you have downloaded Struts.
      
  3. Go to the "struts-1.2.9-bin\webapps" directory and you will find struts-blank.war, struts-documentation.war, struts-examples.war, struts-mailreader.war and tiles-documentation.war files in the directory. Open struts-blank.war with WinZip and then click on the "Extract" button. WinZip asks for the directory for extracting the file, enter "C:\Struts-Hibernate-Integration" and click on Extract button.

      
  4. A new directory will created "C:\Struts-Hibernate-Integration\code" and the content of struts-blank.war is extracted in the code directory.
      
  5. Now we will add the hibernate code to our development environment. Extract hibernate-3.1.1.zip in the directory where you have downloaded. 
       
  6. Copy "hibernate3.jar" from <your downoaded direvory>\hibernate-3.1  into C:\Struts-Hibernate-Integration\code\WEB-INF\lib directory.
       
  7. Copy all the library files from "hibernate-3.1\lib" to "C:\Struts-Hibernate-Integration\code\WEB-INF\lib" directory.
      
  8. Create an directory libext under "C:\Struts-Hibernate-Integration\code\WEB-INF\" . We will used this directory to put extra jar files. Copy servlet-api.jar file your tomcat directory to "C:\Struts-Hibernate-Integration\code\WEB-INF\libext" directory. 
      
  9. Change in the build.xml file: Open "C:\Struts-Hibernate-Integration\code\WEB-INF\src\build.xml" file in your favourite editor and change as instructed below:
    a) Find "<property name="servlet.jar" value="/javasoft/lib/servlet.jar"/>" in the build.xml file and change it to "<property name="servlet.jar" value="./libext/servlet-api.jar"/>"
    b) Find "<property name="distpath.project" value="/projects/lib"/>" and change it to "<property name="distpath.project" value="../../dist"/>"
    c) Change "<property name="jdbc20ext.jar" value="/javasoft/lib/jdbc2_0-stdext.jar"/>" to "<property name="jdbc20ext.jar" value="./libext/jdbc2_0-stdext.jar"/>".
    d) Change "<property name="project.title" value="Jakarta Struts Blank "/>" to "<property name="project.title" value="RoseIndia.net Struts Hibernate Integration Tutorial "/>"
    e) Change "<property name="project.distname" value="blank"/>" to "<property name="project.distname" value="strutshibernate"/>"
    e) Change "<target name="project" depends="clean,prepare,compile,javadoc"/>" to "<!--<target name="project" depends="clean,prepare,compile"/>-->"
    You can download my build.xml fom here.
      
  10. Open console and go to the "C:\Struts-Hibernate-Integration\code\WEB-INF\src" directory  and type ant to compile the project. This show the following out put:

    C:\Struts-Hibernate-Integration\code\WEB-INF\src>ant
    Buildfile: build.xml

    clean:
    [delete] Deleting directory C:\Struts-Hibernate-Integration\code\WEB-INF\clas
    ses
    [mkdir] Created dir: C:\Struts-Hibernate-Integration\code\WEB-INF\classes

    prepare:

    resources:
    [copy] Copying 1 file to C:\Struts-Hibernate-Integration\code\WEB-INF\class
    es

    compile:

    project:

    dist:
    [jar] Building jar: C:\Struts-Hibernate-Integration\dist\strutshibernate.j
    ar
    [war] Building war: C:\Struts-Hibernate-Integration\dist\strutshibernate.w
    ar
    [war] Warning: selected war files include a WEB-INF/web.xml which will be
    ignored (please use webxml attribute to war task)

    all:

    BUILD SUCCESSFUL
    Total time: 3 seconds
    C:\Struts-Hibernate-Integration\code\WEB-INF\src>


    and it will create C:\Struts-Hibernate-Integration\dist\strutshibernate.war file which you can deploy on application server to test. You can ignore the warning generated while running the ant build tool.
       
  11. To test the application copy the strutshibernate.war to your tomcat webapps dirctory and start tomcat.
      
  12. Open browser and type http://localhost:8080/strutshibernate/. You browser page should look like: 
      

      
    This means you have successfully configured your development environment.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

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.

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

Current Comments

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

i can't extract struts-blank 1.3.8.it show struts-blank 1.3.8 not a application of win32.what i have to do

Posted by pham quynh hoa on Monday, 09.22.08 @ 11:32am | #80586

which is the best place for checking for invalidate session in only one place.
i am using struts framework

Posted by Anuj Patil on Wednesday, 09.26.07 @ 19:34pm | #29726

i have followed the steps provided in this but i m getting the error while startup the Tomcat..
**** Initilizing HibernatePlugIn **********
Error while initializing hibernate: JDBC Driver class not found: com.mysql.jdbc.
Driver
*************************************
Tomcat 5.5 && mysql-connector-java-3.0.17-ga.jar & jdk1.4.2 & struts-1.2.9-bin were used.....

it would be great for me if anybody Helps on this,, Thanks in advance.

Karthik.

Posted by Karthik on Wednesday, 09.12.07 @ 01:48am | #26799

I think U forgot to add ant feature to project. Please add that it will be easy.

Posted by Preeti on Thursday, 04.19.07 @ 01:29am | #14525

hi i think u did not mention how to add the ant features to the project before building the war file with ant build

Posted by sreenu on Tuesday, 04.17.07 @ 14:53pm | #14425

Training Courses
Tell A Friend
Your Friend Name
Search Tutorials:

 

 
 

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

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

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

Copyright © 2008. All rights reserved.