Srikanth Technologies

Integrating Struts With Hibernate Through DAO Pattern

I have developed a simple CRUD (Create Read Update and Delete) application using Struts as web framework, Hibernate for ORM and DAO (Data Access Object) design pattern.

Follow the steps given below to run this sample application using NetBeans 6.5.

  1. Download struts_hib_crud.rar.
  2. Use WinRar to extract it to C:\ drive so that c:\strut_hib_crud folder is created, which contains the project.
  3. When you open the project using NetBeans, it complains about missing references as libraries are removed from the .rar file to make download small.
  4. Go to properties of the project and remove references to libraries using Libraries node in project properties window. Select library and click on Remove button.
  5. Then add the following libraries to the project using libraries node. Use Add Library button or Add JAR/Folder button as the case may be.
    • Hibernate JPA
    • Struts 1.2.9
    • ojdbc14.jar for Oracle 10g
  6. Build project to make sure you have compiled all classes properly.
  7. Deploy the project. It starts Tomcat, if it is not already running.
  8. Before you run project, create the following table in Oracle database in HR account.
     create table subscribers
     ( 
      email varchar(50) primary key,
      fullname varchar(50),
      dj   date
     );
     

When you run the application, you get three options - List of Subscribers, Add New Subscriber and Delete Subscriber. List of subscribers displays the list of existing subscribers and allows you to modify the fullname of the subscriber using update form.

Post Your Comment

Image

Enter the code given in the above image :
Enter Your Name :
Enter Your Email Address :
Enter Your Comment :

Comments


Posted By madhusudhan On 27-May-09 02:55:43 PM

sir,in the delete.jsp,we are giving the email(which is an identifier) in the text box and on clicking the delete button.then the values are deleted. instead on clicking the delete button itself the values should be deleted.



Posted By d.shanthi kiran naidu On 28-Aug-10 12:16:11 PM

hai i want step by step to perform the crud application



Posted By srinivas On 19-Feb-11 03:31:14 PM

Please I need struts with hibernate application through DAO pattrern. Please forward me.



Posted By Karthik On 05-Mar-12 04:23:04 PM

Hi i need struts1.3+Hibernate integration application through DAO pattrern.Using only one table.Please forward me.



Posted By tom cruse On 03-Sep-12 01:02:44 PM


Hi,

Your application is very nice n working fine. I have one problem that i didn't understand from your application...

1. Why there is a need to create a separate class (POJO) for subscriber when we have ActionForm for the same ? (Subscriber & Add ActionForm have same methods for email n name attributes)

2. Can you explain the use of following files :-
a. hibernate.reveng.xml
b. tiles-defs.xml
c. validation.xml
d. validator-rules.xml

the same application can be created using only ActionForm then why Subscriber class ?????????????.......

plz post answer of these questions i m in confusion....

thanks a lot





Posted By raj On 23-Jan-16 08:20:43 PM

nice tutorials