Magazine
 
Integrating Struts and Hibernate
 

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”/>”


f) Change “<target name=”project”
depends=”clean,prepare,compile,javadoc”/
>” to “<!—<target name=”project”
depends=”clean,prepare,compile”/
>—>”


10. Open console and go to the “C:\Struts- Hibernate-Integration\code\WEBINF\ src” directory and type ant to compile the project. This show the following out put:

C:\Struts-Hibernate-Integration\code\WEBINF\ 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.war [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\WEBINF\
src>

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 directory 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.

Writing Hibernate Configuration Files
In the previous section we completed the database setup and created required table and populated with the data. In this section we will write required hibernate configuration files. For this application, we need following Hibernate
configuration files:

Dec 2007 | Java Jazz Up | 54
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