In this tutorial we will create a web application using Struts2, Hibernate 4 and Maven.
We will create a page where we can add an Employee to a MySQL database. The application will be deployed on Tomcat server.
First of all, lets create a Struts2 project using following Struts2 Blank archetype from Maven.
If you need help downloading maven, you can refer to this post :
After Maven is installed, make sure JAVA_HOME is setup to your java installation folder and Maven bin folder is added to PATH variable. The instructions can again be found in post referred above.
Now, run the following from the command line :
mvn archetype:generate -DarchetypeCatalog=http:
Now provide the below for next options(you can add your own names here) :
groupid : Struts2Hibernate
artifactid : Struts2HibernateApp
version : 1.0–SNAPSHOT
package : techkatak
Enter “Y” to confirm and your project will be ready.
Now open the project in Eclipse by selecting File -> Import -> Existing Maven projects and then select the project you created using Maven. Here are some screenshots for the same :
In the second part of this tutorial, we will see how to modify this application to create the New Employee registration page and in the last part of the tutorial, we will integrate hibernate and maven.
Here is the link to part 2 of this tutorial :
© 2015, www.techkatak.com. All rights reserved.