{"id":202,"date":"2007-09-06T00:00:00","date_gmt":"2007-09-06T00:00:00","guid":{"rendered":"http:\/\/www.strongd.net\/?p=202"},"modified":"2007-09-06T00:00:00","modified_gmt":"2007-09-06T00:00:00","slug":"Downloading Struts & Hibernate","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=202","title":{"rendered":"Downloading Struts &#038; Hibernate"},"content":{"rendered":"<p><DIV><br \/>\n<P>In this we will download Struts &amp; Hibernate and setup the development environment.<\/P><br \/>\n<P><B>Downloading Hibernate<\/B><\/P><br \/>\n<P>Hibernate is free open source software it can be download from <A href=\"http:\/\/www.hibernate.org\/\" target=_blank>http:\/\/www.hibernate.org\/<\/A>. Visit <A href=\"http:\/\/www.hibernate.org\/\" target=_blank>http:\/\/www.hibernate.org\/<\/A> 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 <B>hibernate-3.1.1.zip<\/B>.<\/P><br \/>\n<P><B>Download Struts<\/B><\/P><br \/>\n<P>The latest release of Struts can be downloaded from <A href=\"http:\/\/struts.apache.org\/download.cgi\">http:\/\/struts.apache.org\/download.cgi<\/A>. For this tutorial I have download struts-1.2.9-bin.zip. Save downloaded file into your hard disk.<\/P><br \/>\n<P><B>Downloading Ant<\/B><\/P><br \/>\n<P>Ant is a free tool under GNU Licence and is freely available at <A href=\"http:\/\/jakarta.apache.org\/ant\/\">http:\/\/jakarta.apache.org\/ant\/<\/A> , 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.<\/P><br \/>\n<P><B>Download MySQL JDBC Driver<\/B><BR>Download mysql-connector-java-3.0.16-ga-bin.jar from here <A href=\"http:\/\/www.mysql.com\">mysql-connector-java<\/A> 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 <B>jakarta-tomcat-5.5.9\\common\\lib<\/B> directory of your tomcat installation. This will add the MySQL JDBC driver to the tomcat server.<\/P><br \/>\n<P><B>Setting Up Development Environment<\/B><\/P><br \/>\n<P>First we will create necessary directories and moved the required files to the appropriate directory. Follow the following steps to accomplish this:<\/P><br \/>\n<OL><br \/>\n<LI>Create a directory in you c: drive called <B>Struts-Hibernate-Integration<\/B>.<BR>&nbsp;&nbsp;<br \/>\n<LI>Unzip Downloaded file in the directory you have downloaded Struts.<BR>&nbsp;&nbsp;<br \/>\n<LI>Go to the &#8220;<B>struts-1.2.9-bin\\webapps<\/B>&#8221; directory and you will find <B>struts-blank.war<\/B>, <B>struts-documentation.war<\/B>, <B>struts-examples.war<\/B>, <B>struts-mailreader.war<\/B> and <B>tiles-documentation.war<\/B> files in the directory. Open <B>struts-blank.war<\/B> with WinZip and then click on the &#8220;Extract&#8221; button. WinZip asks for the directory for extracting the file, enter &#8220;<B>C:\\Struts-Hibernate-Integration<\/B>&#8221; and click on Extract button.<BR><IMG height=361 src=\"http:\/\/www.roseindia.net\/struts\/struts-hibernate\/extract-struts-blank.gif\" width=588 border=0><BR>&nbsp;&nbsp;<br \/>\n<LI>A new directory will created &#8220;<B>C:\\Struts-Hibernate-Integration\\code<\/B>&#8221; and the content of <B>struts-blank.war<\/B> is extracted in the code directory.<BR>&nbsp;&nbsp;<br \/>\n<LI>Now we will add the hibernate code to our development environment. Extract <B>hibernate-3.1.1.zip<\/B> in the directory where you have downloaded.&nbsp;<BR>&nbsp;&nbsp;&nbsp;<br \/>\n<LI>Copy &#8220;<B>hibernate3.jar<\/B>&#8221; from &lt;your downoaded direvory&gt;\\<B>hibernate-3.1&nbsp;<\/B> into <B>C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\lib<\/B> directory.<BR>&nbsp;&nbsp;&nbsp;<br \/>\n<LI>Copy all the library files from &#8220;<B>hibernate-3.1\\lib<\/B>&#8221; to &#8220;<B>C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\lib<\/B>&#8221; directory.<BR>&nbsp;&nbsp;<br \/>\n<LI>Create an directory <B>libext<\/B> under &#8220;<B>C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\<\/B>&#8221; . We will used this directory to put extra jar files. Copy <B>servlet-api.jar<\/B> file your tomcat directory to &#8220;<B>C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\libext&#8221;<\/B> directory.&nbsp;<BR>&nbsp;&nbsp;<br \/>\n<LI>Change in the build.xml file: Open &#8220;<B>C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\src\\build.xml<\/B>&#8221; file in your favourite editor and change as instructed below:<BR>a) Find &#8220;<B>&lt;property name=&#8221;servlet.jar&#8221; value=&#8221;\/javasoft\/lib\/servlet.jar&#8221;\/&gt;<\/B>&#8221; in the build.xml file and change it to &#8220;<B>&lt;property name=&#8221;servlet.jar&#8221; value=&#8221;.\/libext\/servlet-api.jar&#8221;\/&gt;<\/B>&#8220;<BR>b) Find &#8220;<B>&lt;property name=&#8221;distpath.project&#8221; value=&#8221;\/projects\/lib&#8221;\/&gt;<\/B>&#8221; and change it to &#8220;<B>&lt;property name=&#8221;distpath.project&#8221; value=&#8221;..\/..\/dist&#8221;\/&gt;<\/B>&#8220;<BR>c) Change &#8220;<B>&lt;property name=&#8221;jdbc20ext.jar&#8221; value=&#8221;\/javasoft\/lib\/jdbc2_0-stdext.jar&#8221;\/&gt;<\/B>&#8221; to &#8220;<B>&lt;property name=&#8221;jdbc20ext.jar&#8221; value=&#8221;.\/libext\/<\/B><B>jdbc2_0-stdext.jar&#8221;\/&gt;<\/B>&#8220;.<BR>d) Change &#8220;<B>&lt;property name=&#8221;project.title&#8221; value=&#8221;Jakarta Struts Blank &#8220;\/&gt;<\/B>&#8221; to &#8220;<B>&lt;property name=&#8221;project.title&#8221; value=&#8221;RoseIndia.net Struts Hibernate Integration Tutorial &#8220;\/&gt;<\/B>&#8220;<BR>e) Change &#8220;<B>&lt;property name=&#8221;project.distname&#8221; value=&#8221;blank&#8221;\/&gt;<\/B>&#8221; to &#8220;<B>&lt;property name=&#8221;project.distname&#8221; value=&#8221;strutshibernate&#8221;\/&gt;<\/B>&#8220;<BR>e) Change &#8220;<B>&lt;target name=&#8221;project&#8221; depends=&#8221;clean,prepare,compile,javadoc&#8221;\/&gt;<\/B>&#8221; to &#8220;<B>&lt;!&#8211;&lt;target name=&#8221;project&#8221; depends=&#8221;clean,prepare,compile&#8221;\/&gt;&#8211;&gt;<\/B>&#8220;<BR>You can download my build.xml fom <A href=\"http:\/\/www.roseindia.net\/struts\/struts-hibernate\/build.xml\">here<\/A>.<BR>&nbsp;&nbsp;<br \/>\n<LI>Open console and go to the &#8220;<B>C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\src<\/B>&#8221; directory&nbsp; and type ant to compile the project. This show the following out put:<BR><BR><FONT color=#0000ff>C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\src&gt;ant<BR>Buildfile: build.xml<BR><BR>clean:<BR>[delete] Deleting directory C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\clas<BR>ses<BR>[mkdir] Created dir: C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\classes<BR><BR>prepare:<BR><BR>resources:<BR>[copy] Copying 1 file to C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\class<BR>es<BR><BR>compile:<BR><BR>project:<BR><BR>dist:<BR>[jar] Building jar: C:\\Struts-Hibernate-Integration\\dist\\strutshibernate.j<BR>ar<BR>[war] Building war: C:\\Struts-Hibernate-Integration\\dist\\strutshibernate.w<BR>ar<BR>[war] Warning: selected war files include a WEB-INF\/web.xml which will be<BR>ignored (please use webxml attribute to war task)<BR><BR>all:<BR><BR>BUILD SUCCESSFUL<BR>Total time: 3 seconds<BR>C:\\Struts-Hibernate-Integration\\code\\WEB-INF\\src&gt;<\/FONT><BR><BR>and it will create C:\\Struts-Hibernate-Integration\\dist\\strutshibernate.war file which you can deploy on application server to test. <I>You can ignore the warning generated while running the ant build tool.<\/I><BR>&nbsp;&nbsp;&nbsp;<br \/>\n<LI>To test the application copy the strutshibernate.war to your tomcat webapps dirctory and start tomcat.<BR>&nbsp;&nbsp;<br \/>\n<LI>Open browser and type <A href=\"http:\/\/localhost:8080\/strutshibernate\/\">http:\/\/localhost:8080\/strutshibernate\/<\/A>. You browser page should look like:&nbsp;<BR>&nbsp;&nbsp;<BR><IMG height=462 src=\"http:\/\/www.roseindia.net\/struts\/struts-hibernate\/struts-test-success.gif\" width=534 border=0><BR>&nbsp;&nbsp;<BR>This means you have successfully configured your development environment. <\/LI><\/OL><br \/>\n<DIV><\/DIV><\/DIV><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this we will download Struts &amp; 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 &hellip; <a href=\"https:\/\/www.strongd.net\/?p=202\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Downloading Struts &#038; Hibernate<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=202"}],"version-history":[{"count":0,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}