java2db

How to integrate Struts 2 and Hibernate 5 (Login example)



To integrate Struts 2 and Hibernate 5 , first we need to download all the required jar files because Struts 2 and Hibernate 5 are not an installable softwares .

How to integrate Jsp , Struts 2 and hibernate 4 ( Login example ) Basic requirements to integrate Struts 2 and Hibernate 5 (integration) .

 

Softwares :
Java (Download).
MySQL Database (Download).
GlassFish server (Download).
Eclipse IDE (Download).

 

 

Struts 2 Jar files: (Download).
commons-fileupload-1.3.1.jar  (Download)
commons-io-2.2.jar  (Download)
commons-lang3-3.1.jar  (Download)
commons-logging-1.1.3.jar  (Download)
commons-logging-api-1.1.jar  (Download)
freemarker-2.3.19.jar  (Download)
javassist-3.11.0.GA.jar  (Download)
ognl-3.0.6.jar  (Download)
struts2-core-2.3.16.3.jar  (Download)
xwork-core-2.3.16.3.jar  (Download)

 

 

Hibernate 5 and MtSQL Jar files:
antlr-2.7.7.jar (Download).
geronimo-jta_1.1_spec-1.1.1.jar (Download).
dom4j-1.6.1.jar (Download).
hibernate-commons-annotations-5.0.0.Final.jar (Download).
hibernate-core-5.0.2.Final.jar (Download).
hibernate-jpa-2.1-api-1.0.0.Final.jar (Download).
jandex-1.2.2.Final.jar (Download).
javassist-3.18.1-GA.jar (Download).
jboss-logging-3.1.3.GA.jar (Download).
mysql-connector-java-5.1.6.jar (Download).

 

 

Source files :
login.jsp  
UserAuthentication.java  
User.java  
web.xml  
hibernate.cfg.xml  
Mapping.hbm.xml  
struts.xml  
home.jsp  
error.jsp

 

 

How to integrate Struts 2 and Hibernate 5 (Login example) Complete Directory Structure in Eclipse :

Create a dynamic web project,files in any IDE(Ex : Eclipse , NetBeans , RAD ) and copy the below source code .
How to integrate Struts 2 and Hibernate 5 (Login example)

 

Jsp , struts 2 example in eclipse Source code  for Jsp , Struts 2 and hibernate 5 example :

How to integrate Struts 2 and Hibernate 5 (Login example) login.jsp

How to integrate Struts 2 and Hibernate 5 (Login example) UserAuthentication.java :

Jsp,Servlet and JDBC integration example User.java

Jsp,Servlet and JDBC integration example web.xml

How to integrate Struts 2 and Hibernate 5 (Login example) hibernate.cfg.xml

Jsp,Servlet and JDBC integration example Mapping.hbm.xml

Jsp,Servlet and JDBC integration example struts.xml

Jsp,Servlet and JDBC integration example home.jsp

Jsp,Servlet and JDBC integration example error.jsp

 

Jsp,Servlet and JDBC integration example Create the table , insert the below data in MySQL database.

Below , we are creating the table under default “mysql ” data base, if you want , you can create an another database(Example : mydb) and change the database name “mysql” to “mydb” .

create a servlet You can use any database like Oracle , PostgreSQL or DB2 by changing the hibernate.cfg,xml file.

 

 

 

Deploy the above application in any web/ application server like GlassFish , WebSphere , Jboss , Wildfly or Tomcat .

Enter the URL ” localhost:9090/IntegrationServerAPI/login.jp ”  on the browser address bar.

localhost/127.0.0.1 : Host Ip

9090 : server port (You can check your server port )

IntegrationServerAPI : Dynamic web project root name .

login.jsp : Specific page that integrated in the web.xml (welcome page ).

 

You will get the below response .

 

Jsp,Servlet and JDBC integration example Execution result :

Output : 

Key in user name and password , click Login button. Finally you will get the below success window.

 




Related Posts :
How to integrate Jsp , Struts 2 and hibernate 4 ( Login example )
Jsp , struts 2 example in eclipse (Struts login application )
   [will not be published]



^ <