Registration Form Using Struts Hibernate

September 11, 2017 | Author: Kirti Waykole | Category: World Wide Web Consortium, Computing Platforms, Java Platform, Technology, Computing
Share Embed Donate


Short Description

Download Registration Form Using Struts Hibernate...

Description

Registration Form Using Struts Hibernate First add capabilities of Struts and hibernate Then:-.

hibernate.cfg.xml

org.hibernate.dialect.Oracle9Dialect jdbc:oracle:thin:@localhost:1521:xe system system oracle.jdbc.driver.OracleDriver

Registration.java

package mypack; public class Registration { int id; String name,password,email; public Registration() { super(); } public Registration(String name, String password, String email) { super(); this.name = name; this.password = password; this.email = email; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; }

}

Registration.hbm.xml



DAO.java package mypack; import import import import

org.hibernate.Session; org.hibernate.SessionFactory; org.hibernate.Transaction; org.hibernate.cfg.Configuration;

public class DAO { public void insert(Object o) { Configuration cfg=new Configuration().configure(); SessionFactory f=cfg.buildSessionFactory(); Session session=f.openSession(); Transaction t=session.beginTransaction(); session.save(o); t.commit(); session.close(); } }

index.jsp



a.jsp successfully inserted

Struts.xml /a.jsp

RegistrationAction.java package mypack; public class RegistrationAction { Registration r; public String execute() { DAO dao=new DAO(); dao.insert(r); return "success"; } public Registration getR() { return r; } public void setR(Registration r) { this.r = r; } }

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF