Magazine
 
Integrating Struts and Hibernate
 

build process like compilation, archiving and deployment. For this article we are using apache-ant-1.6.5.

Download MySQL JDBC Driver
Download mysql-connector-java-3.0.16-gabin. 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-connectorjava- 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 your 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, strutsexamples. 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 be 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 a directory libext under “C:\Struts-Hibernate-
Integration\code\WEB-INF\”. We will use 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\WEBINF\ 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”/>”.

Dec 2007 | Java Jazz Up | 53
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 ,

Download PDF