© 2012 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies
Registration Form for online shopping Using Java

Description:

This program shows the sample registration form for Online shopping application. This form has logon information and personal information. Some fields of registration form are declared as mandatory and these are verified whether it is empty or not using JavaScript. Registration.html is the page which has the design coding, it uses the html tags to create text box and submit button. RegisterPage has the code which uses AccountStoreBean and ConnectionManager classes to connect with the database and to store this in the database. AccountStoreBean class uses getter and setter method for each field. Store () method inserts all the fields into the table.

Registration Form for online shopping Using Java:

/ /*AccountStoreBean.java*/ package pc; import java.beans.*; import java.sql.*; public class AccountStoreBean { private String email,name,address,city,pin,phone,company,password,fax,state,country; private int birth_month,res; private ConnectionManager conMan; private Connection con; public void connect() { conMan=new ConnectionManager(); con=conMan.logOn(); } public void disconnect() { conMan.logOff(); } public void setEmail(String email) { this.email=email; } public void setName(String name) { this.name=name; } public void setAddress(String address) { this.address=address; } public void setCity(String city) { this.city=city; } public void setPin(String pin) { this.pin=pin; } public void setPhone(String phone) { this.phone=phone; } public void setCompany(String company) { this.company=company; } public void setPassword(String password) { this.password=password; } public void setFax(String fax) { this.fax=fax; } public void setState(String state) { this.state=state; } public void setCountry(String country) { this.country=country; } public void setBirth_month(int birth_month) { this.birth_month=birth_month; } public int store() { try { PreparedStatement ps=con.prepareStatement("insert into customer values(?,?,?,?,?,?,?,?,?,?,?,?)"); ps.setString(1,email); ps.setString(2,name); ps.setString(3,address); ps.setString(4,city); ps.setString(5,pin); ps.setString(6,phone); ps.setString(7,company); ps.setString(8,password); ps.setString(9,fax); ps.setInt(10,birth_month); ps.setString(11,state); ps.setString(12,country); res=ps.executeUpdate(); ps.close(); } catch(SQLException se) { System.out.println("Jeba Sql Exception:AccountStoreBean:store():"+se); res=2; } return res; } } /*ConnectionManager.java*/ package pc; import java.sql.*; public class ConnectionManager { protected Connection conn; protected String driverName="sun.jdbc.odbc.JdbcOdbcDriver"; protected String url="Jdbc:Odbc:PCDB"; public ConnectionManager() { } public Connection logOn() { try { Class.forName(driverName); conn=DriverManager.getConnection(url,"",""); } catch(Exception e) { System.out.println("Jeba Exception :ConnectionManager:logOn()"+e); e.printStackTrace(); } return conn; } public void logOff() { try { conn.close(); } catch(Exception e) { System.out.println("Jeba Exception:ConnectionManager:logOff()"+e); e.printStackTrace(); } } }

Sample ScreenShot:

 
SLogix Student Projects


⇓ Student Projects ⇓
⇑ Student Projects ⇑
bottom