WordPress.com
Customer.java
package bean;
import java.sql.*;
import java.util.*;
import org.hibernate.cfg.*;
import org.hibernate.*;
public class Customer {
private String customerID;
private String name;
private String address;
private String phoneNo;
private String mailId;
private String searchName;
public String getSearchName() {
return searchName;
}
public void setSearchName(String searchName) {
this.searchName = searchName;
}
public String getCustomerID() {
return customerID;
}
public void setCustomerID(String customerID) {
this.customerID = customerID;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
public String getMailId() {
return mailId;
}
public void setMailId(String mailId) {
this.mailId = mailId;
}
public String addAction() throws SQLException {
try
{
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session s = sf.openSession();
Customer sub = new Customer();
String dbcustid=this.customerID;
String dbcustname=this.name;
String dbcustadd=this.address;
String dbphoneNo=this.phoneNo;
String dbcustmailid=this.mailId;
sub.setCustomerID(dbcustid);
sub.setName(dbcustname);
sub.setAddress(dbcustadd);
sub.setPhoneNo(dbphoneNo);
sub.setMailId(dbcustmailid);
s.beginTransaction();
s.save(sub);
System.out.println("inserted in SearchCustomer Table(Hibernate)--");
s.getTransaction().commit();
s.close();
sf.close();
}catch(Exception ex){
System.out.println("Exception in addAction:-"+ex.getMessage());
}
return "insert";
}
public List getAllCustomer()
{
List custInfoAll = new ArrayList();
try {
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session s = sf.openSession();
s.beginTransaction();
custInfoAll = s.createQuery("from Customer order by name desc").list();
s.getTransaction().commit();
System.out.println("Display values");
s.close();
sf.close();
} catch (Exception e) {
System.out.println("Exception in getAllCustomer::"+e.getMessage());
}
return custInfoAll;
}
public List getCustomerDetail()
{
List custInfo = new ArrayList();
try {
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session s = sf.openSession();
s.beginTransaction();
String hql = "FROM Customer WHERE name ='"+searchName+"'";
Query query = s.createQuery(hql);
custInfo= query.list();
s.getTransaction().commit();
System.out.println("display search data with arg");
s.close();
sf.close();
} catch (Exception e) {
System.out.println("Exception in getCustomerDetail::"+e.getMessage());
}
return custInfo;
}
public String ResultCustomer()
{
getCustomerDetail();
return "result";
}
public String addCustomer() throws SQLException {
try
{
System.out.println("in add customer");
}catch(Exception ex){
System.out.println("Exception in addCustomer:-"+ex.getMessage());
}
return "add";
}
}
index.jsp
insert.jsp
Insert
Back To Search Page
result.jsp
Result
Search Again
search.jsp
Search
hibernate.cfg.xml
com.mysql.jdbc.Driver
root
jdbc:mysql://localhost:3306/test
root
org.hibernate.dialect.MySQLDialect
10
org.hibernate.cache.NoCacheProvider
update
Customer.hbm.xml
faces-config.xml
customer
bean.Customer
request
/search.jsp
#{customer.addCustomer}
add
/insert.jsp
result
/result.jsp
/insert.jsp
#{customer.addAction}
insert
/search.jsp
web.xml
Search-Reasult-Add
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
Faces Servlet
javax.faces.webapp.FacesServlet
1
Faces Servlet
/faces/*
javax.servlet.jsp.jstl.fmt.localizationContext
resources.application
State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2
javax.faces.STATE_SAVING_METHOD
client
This parameter tells MyFaces if javascript code should be allowed in
the rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default is 'true'
org.apache.myfaces.ALLOW_JAVASCRIPT
true
If true, rendered HTML code will be formatted, so that it is 'human-readable'
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default is 'true'
org.apache.myfaces.PRETTY_HTML
true
org.apache.myfaces.DETECT_JAVASCRIPT
false
If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the top
if you trigger a link or button action that stays on the same page.
Default is 'false'
org.apache.myfaces.AUTO_SCROLL
true
org.apache.myfaces.webapp.StartupServletContextListener
table-style.css
.order-table{
border-collapse:collapse;
}
.order-table-header{
text-align:center;
background:none repeat scroll 0 0 #E5E5E5;
border-bottom:1px solid #BBBBBB;
padding:10px;
}
.order-table-odd-row{
text-align:center;
background:none repeat scroll 0 0 #F9F9F9;
border-top:4px solid #BBBBBB;
}
.order-table-even-row{
text-align:center;
background:none repeat scroll 0 0 #F9F9F9;
border-top:4px solid #BBBBBB;
}
body {
background-color: #faebea;
}
table.tbl{
width: 100%;
border-collapse: collapse;
border-bottom: 1px solid #000;
}
table.tbl th,
table.tbl td {
padding: 2px;
text-align: left;
border: 1px solid #BBBBBB;;
border-bottom:0;
}
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
Related searches
- wordpress passing data between pages
- wordpress business templates
- wordpress rss feed not working
- wordpress jquery is not defined
- create wordpress blog
- wordpress roles editor
- wordpress full rss feed
- wordpress rss feed settings
- wordpress rss feed plugin
- wordpress display rss feed
- wordpress rss feed link
- wordpress rss feed to post