diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Cart.class b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Cart.class
new file mode 100644
index 0000000..2cbf66d
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Cart.class differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Cart.java b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Cart.java
new file mode 100644
index 0000000..8032eca
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Cart.java
@@ -0,0 +1,171 @@
+// Cart
+package obs;
+import java.util.*;
+import java.sql.*;
+import obs.*;
+import javax.ejb.*;
+import javax.naming.*;
+import obs.order.*;
+
+
+
+
+public class Cart
+{
+ ArrayList items = new ArrayList();
+
+ public Item find(String isbn)
+ {
+ Iterator itr = items.iterator();
+ Item itm;
+ while ( itr.hasNext())
+ {
+ itm = (Item) itr.next();
+ if ( itm.getIsbn().equals(isbn))
+ {
+ return itm;
+ }
+ } // end of while
+
+ return null;
+ }
+
+ // adds an item if not already existing
+ // otherwise add 1 to qty
+ public void addItem(String isbn )
+ {
+ //check whether isbn is already present
+ Item item = find(isbn);
+ if ( item != null)
+ item.addQty(1);
+ else
+ {
+ // get detais from Books tables
+
+ Connection con =null;
+ obs.User user = new obs.User();
+ try
+ {
+ con = user.getConnection();
+ PreparedStatement ps = con.prepareStatement("select title,price from books where isbn = ? ");
+ ps.setString(1,isbn);
+
+ ResultSet rs = ps.executeQuery();
+ if ( rs.next())
+ {
+ item = new Item(isbn, rs.getString(1), rs.getInt(2) );
+ items.add(item);
+ }
+
+ rs.close();
+ ps.close();
+
+ }
+ catch(Exception ex)
+ {
+ System.out.println(ex.getMessage());
+ }
+ finally
+ {
+ try {con.close();} catch(Exception ex) {}
+ }
+ } // end of else
+ }
+
+ public ArrayList getItems()
+ { return items; }
+
+ public void removeItem(String isbn)
+ {
+ Item item = find(isbn);
+ if ( item != null)
+ items.remove(item);
+ } // end or removeItem
+
+ public void clearAll()
+ {
+ items.clear();
+ }
+
+ public void updateQty(String isbn, int qty)
+ {
+ Item item = find(isbn);
+ if ( item != null)
+ item.setQty(qty);
+ } // end of updateQty()
+
+
+ public String finalizeOrder(int userid)
+ {
+
+ try
+ {
+ Context ctx = getInitialContext();
+ // get access to bean
+
+ OrderHome home = (OrderHome) ctx.lookup("obs.order");
+ Order order = home.create();
+
+ String id= order.addOrder(userid,items);
+ return id;
+ }
+ catch(Exception ex)
+ {
+ System.out.println( ex.getMessage());
+ return null;
+
+ }
+
+ } // end of finalizeOrder
+
+
+
+ public boolean cancelOrder(int ordid)
+ {
+
+ try
+ {
+ Context ctx = getInitialContext();
+ // get access to bean
+
+ OrderHome home = (OrderHome) ctx.lookup("obs.order");
+ Order order = home.create();
+
+ return order.cancelOrder(ordid);
+
+ }
+ catch(Exception ex)
+ {
+ System.out.println( ex.getMessage());
+ return false;
+
+ }
+
+
+ } // end of finalizeOrder
+
+ public Context getInitialContext()
+ {
+
+ String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory";
+
+ try
+ {
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
+ env.put(Context.PROVIDER_URL,"t3://localhost:7001");
+ return new InitialContext(env);
+ }
+ catch(Exception ex)
+ {
+ System.out.println(ex.getMessage());
+ return null;
+ }
+
+ }
+
+}
+
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Customer.java b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Customer.java
new file mode 100644
index 0000000..8751448
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Customer.java
@@ -0,0 +1,200 @@
+// User Bean
+
+package cs;
+import java.sql.*;
+import java.util.*;
+import javax.naming.*;
+import javax.rmi.*;
+
+
+
+public class Customer
+{
+
+
+ private String custname;
+ private String password;
+ private String email;
+ private String phoneno;
+
+ private Context ctx;
+
+ public Context getJNDIContext()
+ {
+ return ctx;
+ }
+
+ public Customer()
+ {
+ ctx = getInitialContext();
+ }
+
+ public void setCustname(String custname)
+ { this.custname = custname; }
+
+ public String getCustname()
+ { return custname; }
+
+
+ public void setPhoneno (String phoneno)
+ { this.phoneno = phoneno; }
+
+ public String getPhoneno()
+ { return phoneno; }
+
+ public void setPassword(String password)
+ { this.password= password; }
+
+ public String getPassword()
+ { return password; }
+
+ public void setEmail (String email)
+ { this.email = email; }
+
+ public String getEmail()
+ { return email; }
+
+ // returns true if uname and pwd are valid
+ public boolean isValid()
+ {
+ Connection con = null;
+ PreparedStatement ps = null;
+ try
+ {
+ con = getConnection();
+ ps = con.prepareStatement("select phoneno, email from customers where custname = ? and pwd= ?");
+ ps.setString(1,custname);
+ ps.setString(2,password);
+
+ ResultSet rs = ps.executeQuery();
+ boolean found = false;
+
+ if ( rs.next())
+ { phoneno = rs.getString("phoneno");
+ email = rs.getString("email");
+ found = true;
+ }
+ return found;
+ }
+ catch(Exception ex)
+ {
+ System.out.println( ex.getMessage());
+ return false;
+ }
+ finally
+ {
+ clean(con,ps);
+ }
+
+ } // end of isValid
+
+ public String updatePassword(String newpassword)
+ {
+ Connection con = null;
+ PreparedStatement ps= null;
+
+ try
+ {
+ con = getConnection();
+ ps = con.prepareStatement("update customers set pwd = ? where custname = ?");
+ ps.setString(1,newpassword);
+ ps.setString(2,custname);
+
+ int cnt = ps.executeUpdate();
+ if ( cnt==1 )
+ return null;
+ else
+ return "Invalid Username!";
+
+ }
+ catch(Exception ex)
+ {
+ System.out.println( ex.getMessage());
+ return ex.getMessage();
+ }
+ finally
+ {
+ clean(con,ps);
+ }
+
+ } // end of updatePassword
+
+ public String registerUser()
+ {
+ Connection con = null;
+ PreparedStatement ps = null;
+
+ try
+ {
+ con = getConnection();
+ ps = con.prepareStatement("insert into customers values (?,?,?,?)");
+ ps.setString(1,custname);
+ ps.setString(2,password);
+ ps.setString(3,email);
+ ps.setString(4,phoneno);
+ ps.executeUpdate();
+ return null;
+
+ }
+ catch(Exception ex)
+ {
+ return ex.getMessage();
+ }
+ finally
+ { clean(con,ps); }
+ }
+
+
+
+
+ public void clean(Connection con, PreparedStatement ps)
+ {
+ try
+ { if ( ps != null ) ps.close();
+ if ( con != null) con.close();
+ }
+ catch(Exception ex)
+ { System.out.println(ex.getMessage()); }
+ }
+
+ public Connection getConnection() throws Exception
+ {
+ Class.forName("oracle.jdbc.driver.OracleDriver");
+ // connect using Thin driver
+ Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:oracle8i",
+ "custsup","custsup");
+
+ return con;
+ }
+
+
+ public Context getInitialContext()
+ {
+
+ String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory";
+
+ try
+ {
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
+ env.put(Context.PROVIDER_URL,"t3://localhost:7001");
+ return new InitialContext(env);
+ }
+ catch(Exception ex)
+ {
+ System.out.println(ex.getMessage());
+ return null;
+ }
+
+ }
+
+
+} // end of bean
+
+
+
+
+
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Item.class b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Item.class
new file mode 100644
index 0000000..70dec1c
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Item.class differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Item.java b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Item.java
new file mode 100644
index 0000000..286839f
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/Item.java
@@ -0,0 +1,43 @@
+// Item class
+package obs;
+public class Item implements java.io.Serializable
+{
+
+ private String isbn,title;
+ private int price;
+ private int qty;
+
+ public Item(String isbn,String title, int price)
+ {
+ this.isbn = isbn;
+ this.title = title;
+ this.price = price;
+ this.qty = 1;
+ }
+ public String getIsbn()
+ {
+ return isbn;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public int getQty()
+ {
+ return qty;
+ }
+
+ public void setQty(int qty)
+ { this.qty = qty; }
+
+ public void addQty(int qty)
+ { this.qty += qty; }
+
+ public int getPrice()
+ {
+ return price;
+ }
+} // end of class
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/User.class b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/User.class
new file mode 100644
index 0000000..abc3b31
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/User.class differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/User.java b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/User.java
new file mode 100644
index 0000000..b97c7c5
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/User.java
@@ -0,0 +1,210 @@
+// User Bean
+
+package obs;
+import java.sql.*;
+import java.util.*;
+
+
+public class User
+{
+ private int userid;
+ private String uname;
+ private String pwd;
+ private String email;
+ private String address;
+ private String phone;
+
+ private boolean logged = false;
+
+ public int getUserid()
+ { return userid; }
+
+ public void setUname(String uname)
+ { this.uname = uname; }
+
+ public String getUname()
+ { return uname; }
+
+ public void setPwd(String pwd)
+ { this.pwd= pwd; }
+
+ public String getPwd()
+ { return pwd; }
+
+ public void setEmail (String email)
+ { this.email = email; }
+
+ public String getEmail()
+ { return email; }
+
+ public void setAddress(String address)
+ { this.address = address; }
+
+ public String getAddress()
+ { return address; }
+
+
+ public void setPhone(String phone)
+ { this.phone = phone; }
+
+ public String getPhone()
+ { return phone; }
+
+
+ public void login()
+ {
+ Connection con = null;
+ PreparedStatement ps = null;
+ try
+ {
+ con = getConnection();
+ ps = con.prepareStatement("select userid,email,phone,address from users where uname = ? and pwd= ?");
+ ps.setString(1,uname);
+ ps.setString(2,pwd);
+
+ ResultSet rs = ps.executeQuery();
+
+ logged = false;
+
+ if ( rs.next())
+ { userid = rs.getInt("userid");
+ email = rs.getString("email");
+ address = rs.getString("address");
+ phone = rs.getString("phone");
+ logged = true;
+ }
+
+ }
+ catch(Exception ex)
+ {
+ System.out.println( ex.getMessage());
+ }
+ finally
+ {
+ clean(con,ps);
+ }
+
+ } // end of isValid
+
+
+
+ public String updateProfile(String newpwd)
+ {
+ Connection con = null;
+ PreparedStatement ps= null;
+
+ try
+ {
+ con = getConnection();
+ String cmd = "update users set email=?, phone = ? , address =? ";
+
+ if (! newpwd.equals(""))
+ cmd += " , pwd = '" + newpwd + "'";
+
+ cmd = cmd + " where userid = ?";
+
+ ps = con.prepareStatement(cmd);
+ ps.setString(1,email);
+ ps.setString(2,phone);
+ ps.setString(3,address);
+ ps.setInt(4,userid);
+
+ int cnt = ps.executeUpdate();
+ if ( cnt==1 )
+ {
+ if ( ! newpwd.equals("") )
+ pwd = newpwd;
+ return null;
+ }
+ else
+ return "Invalid User. Unable to update profile.";
+
+ }
+ catch(Exception ex)
+ {
+ System.out.println( ex.getMessage());
+ return ex.getMessage();
+ }
+ finally
+ {
+ clean(con,ps);
+ }
+
+ } // end of updateProfile
+
+
+
+ public String registerUser()
+ {
+ Connection con = null;
+ PreparedStatement ps = null;
+
+ try
+ {
+ con = getConnection();
+ userid = getNextUserid(con);
+ ps = con.prepareStatement("insert into users values (?,?,?,?,?,?)");
+ ps.setInt(1,userid);
+ ps.setString(2,uname);
+ ps.setString(3,pwd);
+ ps.setString(4,email);
+ ps.setString(5,address);
+ ps.setString(6,phone);
+ ps.executeUpdate();
+ logged = true;
+ return null;
+ }
+ catch(Exception ex)
+ {
+ return ex.getMessage();
+ }
+ finally
+ { clean(con,ps); }
+ }
+
+ public boolean isLogged()
+ { return logged; }
+
+
+ public int getNextUserid(Connection con) throws Exception
+ {
+ PreparedStatement ps = null;
+ ps = con.prepareStatement("select nvl( max(userid),0) + 1 from users");
+ ResultSet rs = ps.executeQuery();
+ rs.next();
+ int nextuserid = rs.getInt(1);
+ rs.close();
+
+ return nextuserid;
+
+ }
+
+
+ public void clean(Connection con, PreparedStatement ps)
+ {
+ try
+ { if ( ps != null ) ps.close();
+ if ( con != null) con.close();
+ }
+ catch(Exception ex)
+ { System.out.println(ex.getMessage()); }
+ }
+
+ public Connection getConnection() throws Exception
+ {
+ Class.forName("oracle.jdbc.driver.OracleDriver");
+ // connect using Thin driver
+ Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:oracle9i",
+ "obs","obs");
+ return con;
+ }
+
+} // end of bean
+
+
+
+
+
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/home.jsp b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/home.jsp
new file mode 100644
index 0000000..88bb2d0
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/home.jsp
@@ -0,0 +1,7 @@
+
+
+
+
+Welcome
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/s.bat b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/s.bat
new file mode 100644
index 0000000..c3d2acd
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/classes/obs/s.bat
@@ -0,0 +1,3 @@
+path c:\jdk1.4\bin;c:\windows\system32
+set classpath=.;c:\jdk1.4\lib\tools.jar;c:\tomcat\common\lib\servlet.jar;c:\tomcat\common\lib\xerces.jar;d:\tomcat\common\lib\activation.jar;c:\tomcat\common\lib\mail.jar;c:\tomcat\webapps\obs\web-inf\classes;c:\tomcat\webapps\obs\web-inf\lib\order_client.jar;c:\weblogic\weblogic700\server\lib\weblogic.jar
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/lib/order_client.jar b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/lib/order_client.jar
new file mode 100644
index 0000000..e3910cd
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/lib/order_client.jar differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/WEB-INF/web.xml b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/web.xml
new file mode 100644
index 0000000..c7555ef
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/WEB-INF/web.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+ login.html
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/addbook.jsp b/Online Book Store Project in JAVA/Online Book Store/addbook.jsp
new file mode 100644
index 0000000..bccca63
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/addbook.jsp
@@ -0,0 +1,21 @@
+
+
+
+<%
+ // check whether user has logged in, otherwise send user to login page
+ out.println( user.isLogged());
+
+ if (!user.isLogged())
+ response.sendRedirect("login.html");
+
+ // read data about item
+
+ String isbn = request.getParameter("isbn");
+
+ cart.addItem(isbn);
+
+ response.sendRedirect("home.jsp");
+
+%>
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/browsebooks.jsp b/Online Book Store Project in JAVA/Online Book Store/browsebooks.jsp
new file mode 100644
index 0000000..b2b04ee
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/browsebooks.jsp
@@ -0,0 +1,42 @@
+
+
+
+
+
+
Browse Available Books
+
+
+
+<%
+ String cat = request.getParameter("cat");
+ if ( cat == null)
+ request.setAttribute("cond","1=1");
+else
+ if (!cat.equals("all") )
+ request.setAttribute("cond", "cat='" + cat + "'");
+
+%>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/changeprofile.html b/Online Book Store Project in JAVA/Online Book Store/changeprofile.html
new file mode 100644
index 0000000..78912ba
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/changeprofile.html
@@ -0,0 +1,68 @@
+
+
+
+
+
+
Change Profile
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/changeprofile.jsp b/Online Book Store Project in JAVA/Online Book Store/changeprofile.jsp
new file mode 100644
index 0000000..d242d7a
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/changeprofile.jsp
@@ -0,0 +1,94 @@
+
+
+
+
+<%
+ if (!user.isLogged())
+ response.sendRedirect("login.html");
+
+%>
+
+
+
+
+
+
+
Change Profile
+
+
+
+<%
+
+ // do it if any invoked by itself
+ if ( request.getParameter("email") == null)
+ return;
+
+ String res = user.updateProfile( request.getParameter("pwd") );
+
+ if ( res == null)
+ out.println("Profile Updated Successfully.");
+ else
+ out.println("Error : " + res);
+
+ out.println("Click here to continue...");
+
+%>
+
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/deleteorder.jsp b/Online Book Store Project in JAVA/Online Book Store/deleteorder.jsp
new file mode 100644
index 0000000..3b29606
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/deleteorder.jsp
@@ -0,0 +1,30 @@
+
+
+
+<%
+ // check whether user has logged in, otherwise send user to login page
+
+ if (!user.isLogged())
+ response.sendRedirect("login.html");
+
+ // read data about item
+
+ String ordid = request.getParameter("ordid");
+
+ boolean result = cart.cancelOrder( Integer.parseInt(ordid));
+ if ( result )
+ out.println("
Order Has Been Cancelled.
");
+ else
+ out.println("
Order could not be cancelled.
");
+
+
+
+%>
+
+
+Orders History
+
+Home Page
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/gohome.jsp b/Online Book Store Project in JAVA/Online Book Store/gohome.jsp
new file mode 100644
index 0000000..f3e9a9d
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/gohome.jsp
@@ -0,0 +1,8 @@
+
+
+<%
+ if ( user.isLogged() )
+ response.sendRedirect("home.jsp");
+ else
+ response.sendRedirect("login.html");
+%>
diff --git a/Online Book Store Project in JAVA/Online Book Store/home.jsp b/Online Book Store Project in JAVA/Online Book Store/home.jsp
new file mode 100644
index 0000000..166eb8c
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/home.jsp
@@ -0,0 +1,159 @@
+
+
+
+
+
+<%@ page import="java.util.*"%>
+
+
+
+<%
+ String act = request.getParameter("act");
+
+ if ( act != null )
+ {
+ if( act.equals("Finalize Order"))
+ {
+ String orderid;
+
+ orderid = cart.finalizeOrder( user.getUserid());
+ if ( orderid == null)
+ {
+ out.println("Sorry! Order Cannot be finalized.");
+ return;
+ }
+ else
+ {
+ out.println("Order Has Been Finalized. Order id : " + orderid );
+ out.println("Continue...");
+ cart.clearAll();
+ return;
+ }
+
+
+ }
+
+ if ( act.equals("remove"))
+ {
+ cart.removeItem( request.getParameter("isbn"));
+ }
+ else
+ if ( act.equals("Update Cart"))
+ {
+
+ String isbn[] = (String []) request.getParameterValues("isbn");
+ String qty[] = (String []) request.getParameterValues("qty");
+
+ for (int i = 0 ;i < isbn.length ;i ++)
+ cart.updateQty(isbn[i], Integer.parseInt( qty[i]));
+
+ }
+ else
+ if ( act.equals("Clear Cart"))
+ cart.clearAll();
+ } // end of outer if
+
+
+%>
+
+
+
+
+
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/image.gif b/Online Book Store Project in JAVA/Online Book Store/image.gif
new file mode 100644
index 0000000..87dd41c
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/image.gif differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/listbooks.jsp b/Online Book Store Project in JAVA/Online Book Store/listbooks.jsp
new file mode 100644
index 0000000..f821e64
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/listbooks.jsp
@@ -0,0 +1,58 @@
+
+<%@ page import="java.sql.*"%>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/login.html b/Online Book Store Project in JAVA/Online Book Store/login.html
new file mode 100644
index 0000000..e249f8e
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/login.html
@@ -0,0 +1,54 @@
+
+
+
+
Online Book Store
+
+
+
+
+
+
+
Introduction
+This site allows you to purchase books online. All that you have to do is add selected books to shopping cart and finalize the order. Books selected by you will be delivered to your door steps. You can pay only after books are delivered.
+
+
+The following are the required steps :
+
+
Login if already registered. Otherwise register as a user. Registration is free.
+
Browser books and add books to shopping cart. Browsing is allowed to everyone, but only registed users can place order.
+
You can modify shopping cart at your will
+
Finalize the order.
+
Pay for books when they are deliverd to your door steps.
+
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/login.jsp b/Online Book Store Project in JAVA/Online Book Store/login.jsp
new file mode 100644
index 0000000..5416ff9
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/login.jsp
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/logout.jsp b/Online Book Store Project in JAVA/Online Book Store/logout.jsp
new file mode 100644
index 0000000..3841647
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/logout.jsp
@@ -0,0 +1,4 @@
+<%
+ session.invalidate();
+ response.sendRedirect("login.html");
+%>
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/Client.java b/Online Book Store Project in JAVA/Online Book Store/order/Client.java
new file mode 100644
index 0000000..7102a60
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/Client.java
@@ -0,0 +1,34 @@
+package st.hello;
+
+import java.rmi.RemoteException;
+import java.util.Properties;
+import javax.naming.*;
+import javax.ejb.*;
+import javax.rmi.PortableRemoteObject;
+
+public class Client {
+ private static final String JNDI_NAME = "st.hello";
+
+ public static void main(String[] args) throws Exception
+ {
+ String url = "t3://localhost:7001";
+
+ Properties h = new Properties();
+ h.put(Context.INITIAL_CONTEXT_FACTORY,
+ "weblogic.jndi.WLInitialContextFactory");
+ h.put(Context.PROVIDER_URL, url);
+ Context ctx = new InitialContext(h);
+
+ // Lookup the beans home using JNDI
+
+ Object home = ctx.lookup(JNDI_NAME);
+ HelloHome hellohome = (HelloHome) PortableRemoteObject.narrow(home,HelloHome.class);
+
+ Hello hello = hellohome.create();
+
+ System.out.println(hello.sayHello("Srikanth"));
+
+ }
+
+
+}
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/Item.java b/Online Book Store Project in JAVA/Online Book Store/order/Item.java
new file mode 100644
index 0000000..7f6210b
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/Item.java
@@ -0,0 +1,45 @@
+// Item class
+package obs;
+
+public class Item
+ implements java.io.Serializable
+{
+
+ private String isbn,title;
+ private int price;
+ private int qty;
+
+ public Item(String isbn,String title, int price)
+ {
+ this.isbn = isbn;
+ this.title = title;
+ this.price = price;
+ this.qty = 1;
+ }
+ public String getIsbn()
+ {
+ return isbn;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public int getQty()
+ {
+ return qty;
+ }
+
+ public void setQty(int qty)
+ { this.qty = qty; }
+
+ public void addQty(int qty)
+ { this.qty += qty; }
+
+ public int getPrice()
+ {
+ return price;
+ }
+} // end of class
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/Order.java b/Online Book Store Project in JAVA/Online Book Store/order/Order.java
new file mode 100644
index 0000000..3398c6f
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/Order.java
@@ -0,0 +1,13 @@
+package obs.order;
+
+import java.rmi.RemoteException;
+import javax.ejb.EJBObject;
+import java.util.*;
+
+public interface Order extends EJBObject
+{
+
+ public String addOrder(int userid, ArrayList items)
+ throws RemoteException;
+ public boolean cancelOrder(int ordid) throws RemoteException;
+}
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/OrderBean.java b/Online Book Store Project in JAVA/Online Book Store/order/OrderBean.java
new file mode 100644
index 0000000..6b223e0
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/OrderBean.java
@@ -0,0 +1,153 @@
+package obs.order;
+
+import javax.ejb.*;
+import javax.naming.*;
+import javax.sql.*;
+import java.sql.*;
+import java.util.*;
+import obs.*;
+
+
+
+public class OrderBean implements SessionBean {
+
+ public void ejbActivate() {}
+ public void ejbRemove() {} // end of remove
+
+ public void ejbPassivate() {}
+ public void setSessionContext(SessionContext ctx) {}
+
+ public void ejbCreate () throws CreateException {}
+
+
+ public String addOrder(int userid, ArrayList items)
+ {
+ Connection con=null;
+ String ordid;
+ PreparedStatement ps=null;
+
+ try
+ {
+
+ Context ctx = new InitialContext();
+ DataSource ds = (DataSource) ctx.lookup("oracle");
+ con =ds.getConnection();
+
+ // get highest order id + 1 for this order
+ ps= con.prepareStatement("select ordid.nextval from dual");
+ ResultSet rs= ps.executeQuery();
+ rs.next();
+
+ ordid = rs.getString(1);
+
+ rs.close();
+
+ // get total amount
+
+ int totamt =0;
+ Item item;
+
+ Iterator itr = items.iterator();
+ while ( itr.hasNext())
+ {
+ item = (Item) itr.next();
+ totamt += item.getPrice() * item.getQty();
+ }
+
+
+ ps = con.prepareStatement("insert into orders values(?,?,sysdate,?,'n')");
+ ps.setString(1,ordid);
+ ps.setInt(2,userid);
+ ps.setInt(3,totamt);
+
+ ps.executeUpdate();
+ ps.close();
+
+ // insert into orderitems
+
+ ps = con.prepareStatement("insert into orderitem values(?,?,?,?)");
+
+ itr = items.iterator();
+ while ( itr.hasNext())
+ {
+ item = (Item) itr.next();
+ ps.setString(1,ordid);
+ ps.setString(2, item.getIsbn());
+ ps.setInt(3,item.getPrice());
+ ps.setInt(4,item.getQty());
+
+ ps.executeUpdate();
+ }
+
+
+ return ordid;
+
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ try
+ { if (ps != null ) ps.close();
+ if (con != null) con.close();
+ }
+ catch(Exception ex) {}
+ }
+ return null;
+
+ } // end of addOrder
+
+
+
+ public boolean cancelOrder(int ordid)
+ {
+ Connection con=null;
+ PreparedStatement ps=null;
+
+ try
+ {
+
+ Context ctx = new InitialContext();
+ DataSource ds = (DataSource) ctx.lookup("oracle");
+ con =ds.getConnection();
+
+ // delete from ORDERITEM table
+
+ ps = con.prepareStatement("delete from orderitem where ordid = ?");
+ ps.setInt(1,ordid);
+
+ ps.executeUpdate();
+ ps.close();
+
+ // delete from ORDERS table
+
+ ps = con.prepareStatement("delete from orders where ordid = ?");
+ ps.setInt(1,ordid);
+
+ int cnt = ps.executeUpdate();
+ ps.close();
+
+ if (cnt == 1) return true;
+ else return false;
+
+
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ try
+ { if (ps != null ) ps.close();
+ if (con != null) con.close();
+ }
+ catch(Exception ex) {}
+ }
+ return false;
+
+ } // end of cancelOrder
+
+} // end of OrderBean
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/OrderHome.java b/Online Book Store Project in JAVA/Online Book Store/order/OrderHome.java
new file mode 100644
index 0000000..e5f5a69
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/OrderHome.java
@@ -0,0 +1,9 @@
+package obs.order;
+
+import java.rmi.RemoteException;
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+public interface OrderHome extends EJBHome {
+ Order create() throws CreateException, RemoteException;
+}
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/Se.bat b/Online Book Store Project in JAVA/Online Book Store/order/Se.bat
new file mode 100644
index 0000000..e7d0227
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/Se.bat
@@ -0,0 +1,4 @@
+set classpath=.;c:\jdk1.4\lib\tools.jar;c:\weblogic\weblogic700\server\lib\weblogic.jar;d:\weblogic7\weblogic700
+
+path=c:\weblogic\weblogic700\server\bin;c:\jdk1.4\bin;c:\windows\system32
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/application.xml b/Online Book Store Project in JAVA/Online Book Store/order/application.xml
new file mode 100644
index 0000000..e6d89dc
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/application.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ Order Bean
+ Online Book Store - Order Bean
+
+
+ order.jar
+
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/build.xml b/Online Book Store Project in JAVA/Online Book Store/order/build.xml
new file mode 100644
index 0000000..8e1cb1e
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/build.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/build/META-INF/ejb-jar.xml b/Online Book Store Project in JAVA/Online Book Store/order/build/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..361b73d
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/build/META-INF/ejb-jar.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+ Order
+ obs.order.OrderHome
+ obs.order.Order
+ obs.order.OrderBean
+ Stateless
+ Container
+
+
+ order_client.jar
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/build/META-INF/weblogic-ejb-jar.xml b/Online Book Store Project in JAVA/Online Book Store/order/build/META-INF/weblogic-ejb-jar.xml
new file mode 100644
index 0000000..0b7242f
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/build/META-INF/weblogic-ejb-jar.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ Order
+ obs.order
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/build/obs/Item.class b/Online Book Store Project in JAVA/Online Book Store/order/build/obs/Item.class
new file mode 100644
index 0000000..72b9006
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/order/build/obs/Item.class differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/Order.class b/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/Order.class
new file mode 100644
index 0000000..63031e6
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/Order.class differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/OrderBean.class b/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/OrderBean.class
new file mode 100644
index 0000000..1bfbed6
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/OrderBean.class differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/OrderHome.class b/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/OrderHome.class
new file mode 100644
index 0000000..b40cd0b
Binary files /dev/null and b/Online Book Store Project in JAVA/Online Book Store/order/build/obs/order/OrderHome.class differ
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/ejb-jar.xml b/Online Book Store Project in JAVA/Online Book Store/order/ejb-jar.xml
new file mode 100644
index 0000000..361b73d
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/ejb-jar.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+ Order
+ obs.order.OrderHome
+ obs.order.Order
+ obs.order.OrderBean
+ Stateless
+ Container
+
+
+ order_client.jar
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/examples.properties b/Online Book Store Project in JAVA/Online Book Store/order/examples.properties
new file mode 100644
index 0000000..8acef14
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/examples.properties
@@ -0,0 +1,24 @@
+#choose classic, modern, jikes, or jvc
+JAVAC=modern
+BEA_HOME=C:/weblogic
+WL_HOME=C:/weblogic/weblogic700
+SAMPLES_HOME=C:/weblogic/weblogic700/samples
+CLIENT_CLASSES=C:/weblogic/weblogic700/samples/server/stage/examples/clientclasses
+SERVER_CLASSES=C:/weblogic/weblogic700/samples/server/stage/examples/serverclasses
+EX_WEBAPP_CLASSES=C:/weblogic/weblogic700/samples/server/stage/examples/examplesWebApp/WEB-INF/classes
+EX_WEBAPP=C:/weblogic/weblogic700/samples/server/stage/examples/examplesWebApp
+APPLICATIONS=C:/weblogic/weblogic700/samples/server/config/examples/applications
+CLASSPATH=${java.class.path}
+XMLRegistry=C:/weblogic/weblogic700/samples/server/config/examples/xml/registries/examplesXMLRegistry
+PORT=7001
+WINDOWS="Windows XP,Windows 2000,Windows NT,Windows 98,Windows 95"
+UNIX="HP-UX,Solaris,SunOS,AIX,Linux"
+
+# Database properties
+# These user defined properties are available to automate
+# table setup for those examples that use an Oracle database.
+DBSERVER=
+DBPORT=
+SID=
+USER=
+PASSWORD=
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/setclientenv.bat b/Online Book Store Project in JAVA/Online Book Store/order/setclientenv.bat
new file mode 100644
index 0000000..3f583cc
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/setclientenv.bat
@@ -0,0 +1,4 @@
+set classpath=.;d:\jdk1.4\lib\tools.jar;d:\weblogic7\weblogic700\server\lib\weblogic.jar;d:\weblogic7\weblogic700\samples\server\stage\examples\clientclasses;d:\weblogic7\weblogic700\samples\server\stage\examples\clientclasses\hello_client.jar
+
+path=d:\weblogic7\weblogic700\server\bin;d:\jdk1.4\bin;c:\windows\system32
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/order/weblogic-ejb-jar.xml b/Online Book Store Project in JAVA/Online Book Store/order/weblogic-ejb-jar.xml
new file mode 100644
index 0000000..0b7242f
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/order/weblogic-ejb-jar.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ Order
+ obs.order
+
+
+
diff --git a/Online Book Store Project in JAVA/Online Book Store/orderitems.jsp b/Online Book Store Project in JAVA/Online Book Store/orderitems.jsp
new file mode 100644
index 0000000..c4fa632
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/orderitems.jsp
@@ -0,0 +1,91 @@
+
+<%@page import="java.sql.*"%>
+
+
+
+
+
+
Order Items
+
+
+
+<%
+ String ordid = request.getParameter("ordid");
+ String status = request.getParameter("status");
+
+ String cmd = "select oi.isbn,title, oi.price,qty, oi.price * qty amount from orderitem oi, books b where b.isbn = oi.isbn and ordid = " + ordid;
+
+
+ Connection con = user.getConnection();
+ Statement st = con.createStatement();
+
+ ResultSet rs = st.executeQuery(cmd);
+
+%>
+
+
+<%
+ if ( status.equals("n"))
+ {
+%>
+
+Cancel This Order
+
+
+<%
+
+
+ }
+%>
+
+
+
+Back
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/ordershistory.jsp b/Online Book Store Project in JAVA/Online Book Store/ordershistory.jsp
new file mode 100644
index 0000000..50db2e2
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/ordershistory.jsp
@@ -0,0 +1,107 @@
+
+<%@page import="java.sql.*"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/querybooks.jsp b/Online Book Store Project in JAVA/Online Book Store/querybooks.jsp
new file mode 100644
index 0000000..d464e66
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/querybooks.jsp
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
Query Books
+
+
+<%
+ String cat = request.getParameter("cat");
+ if ( cat == null)
+ return;
+
+ String cond = "1=1";
+
+ if (!cat.equals("all") )
+ cond = cond + " and cat = '" + cat + "'";
+
+ String title = request.getParameter("title");
+
+ if ( !title.equals(""))
+ cond = cond + " and title like '%" + title + "%'";
+
+
+ String author = request.getParameter("author");
+
+ if ( !author.equals(""))
+ cond = cond + " and author like '%" + author + "%'";
+
+
+ String fromprice = request.getParameter("fromprice");
+
+ if ( !fromprice.equals(""))
+ cond = cond + " and price >= " + fromprice;
+
+ String toprice = request.getParameter("toprice");
+
+ if ( !toprice.equals(""))
+ cond = cond + " and price <= " + toprice;
+
+ request.setAttribute("cond", cond);
+
+%>
+
+
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/register.html b/Online Book Store Project in JAVA/Online Book Store/register.html
new file mode 100644
index 0000000..709895c
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/register.html
@@ -0,0 +1,68 @@
+
+
+
+
+
+
New User Registration
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Online Book Store Project in JAVA/Online Book Store/register.jsp b/Online Book Store Project in JAVA/Online Book Store/register.jsp
new file mode 100644
index 0000000..f0e0002
--- /dev/null
+++ b/Online Book Store Project in JAVA/Online Book Store/register.jsp
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+<%
+ String result = user.registerUser();
+
+ if ( result == null)
+ response.sendRedirect("home.jsp");
+ else
+ out.println("