Sie sind auf Seite 1von 134

SWAMI DEVI DYAL INSTITUTE OF

ENGINEERING AND TECHNOLOGY

(KURUKSHETRA UNIVERSITY, KURUKSHETRA)

SYNOPSIS
ON
SEMENTIC WEB

SUBMITTED TO: SUBMITTED BY:


Er. RAJAN NAME: SANDEEP SINGH
(CSE. DEPT) ROLLNO: 2208282
ACKNOWLEDGEMENT

We are deeply indebted to Ms.Neha gupta incharge of the


project and our project guider. For her inspiring and
encouraging guidance without which the project work could
not have been completed inspire of her busy schedule, she
always had time to attend the problems faced by us in our
project work. We will always remember her quickly
analysis comprehensive solution and critical review, she has
given throughout the project.
And at the last but not least, we express our
indebtness to all my friends for their patience & help
extended in this end over.

Submitted by:-
Ankur Goyal(2208608)
IT 5th sem

INDEX
1. INTRODUCTION
1.1 JAVA SERVLET
1.2 RMI
1.3 JDBC-ODBC
1.4 DATAGRAM

2. SYSTEM REQUIREMENTS
3.2 PLATFORM
3.2.1 Software Requirements
3.2.2 Hardware Requirements

3. IMPLEMENTATION

5.1 FORMS
5.2 COADING
Front.java
import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class front extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
pw.print("<html>");
pw.print("<body>");
pw.print("<p align=right> " + " <a
href='http://localhost:8080/servlet/front'>" + "<font
color=#15317E><b> " + " HOME</a> " + " &nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/aboutus'> " + " <font
color=#15317E><b> " + " ABOUT US " + "</a> " + " &nbsp;&nbsp;
" + " <a href=> " + " <font color=#15317E><b> " + "
FEEDBACK</a> " + " </p> " + " <img
src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4>");
pw.print("<img src='D:\\onlineshopping\\sidelogo.jpg' align=left> " +
" <img src='D:\\onlineshopping\\sidelogo.jpg' align=right>" + "
<br><br>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<font size=10 color=#347C17 ><b> " + " <i>ONLINE
SHOPPING</i></b> " + " </font>");
pw.print("<hr width=100% color=orange size=2 >");
pw.print("<font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/registration1'> " + " New user</a>
" + " &nbsp;&nbsp;" + " <font color=#15317E> " + " <a

href='http://localhost:8080/servlet/regis'><b> " + " Registered


user</a> " + " &nbsp;&nbsp; " + " <font color=#15317E> " + " <a
href='http://localhost:8080/servlet/accountinfo'><b> " + "
MyAccount</a>");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; " + " <font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");
pw.print("<hr width=100% color=#3BB9FF size=10 >");
pw.print("<marquee > " + " <font color=orange size=3><b> " + "
Welcome to Online Shopping " + " </font> " + " </marquee> " + "
<br><br><br><br>");

pw.print("</table>");
pw.print("<table border=2 bgcolor= white align=right cellpadding=2
cellspacing=2 >");
pw.print("<th> " + " <font size=6 color=#347C17><b> " +
"Electronics goods " + "</font> " + " </th>");
pw.print("<tr> " + "<td> " + " <a
href='http://localhost:8080/servlet/ece'> " + "<img
src='D:\\onlineshopping\\tv1.jpg'> " + "</a> ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='d:\\onlineshopping\\mobile.html'> " + "<img
src='D:\\onlineshopping\\mb2.jpg'></a>");

pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/ece'> " + "<img
src='D:\\onlineshopping\\dvd2.jpg'> " + " </a> ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/ece'> " + "<img
src='D:\\onlineshopping\\lp1.jpg'> " + "</a> " + "</td> " + "</tr>");
pw.print("<th> " + "<font size=6 color=#347C17><b> " + "Art &
Games</b> " + "</font>");
pw.print("<tr> " + "<td> " + "<a
href='http://localhost:8080/servlet/art'> " + "<img
src='D:\\onlineshopping\\art1.jpg'> " + "</a>");
pw.print("<a href='http://localhost:8080/servlet/game'> " + "<img
src='D:\\onlineshopping\\gm1.jpg'> " + "</a>");
pw.print("<a href='http://localhost:8080/servlet/art'> " + "<img
src='D:\\onlineshopping\\art2.jpg'> " + "</a>");
pw.print("<a href='http://localhost:8080/servlet/game'> " + "<img
src='D:\\onlineshopping\\gm2.jpg'> " + "</a> " + "</td> " + "</tr> "
+ "</table>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left> " +
"<br><br><br>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left
width=190>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4 > " + "Electronics & " + "
&nbsp;&nbsp;&nbsp; Computer " + "</a> " + "</td> " + "</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/art '> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Art & Paintings " +
"</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");

pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/book '>


" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Books & Magazines "
+ "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/mobile
'> " + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Mobile & Cameras<b>
" + "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a
href='http://localhost:8080/servlet/game.html '> " + "<font
color=white size=4 > " + "<img src='D:\\onlineshopping\\arw.jpg'
align=left hight=20 width=20> " + "Games<b> " + "</a> " + "</td>");
pw.print("</tr> " + "</table> " +
"<br><br><br><br><br><br><br><br><br><br>");
pw.print("<img src='d:\\onlineshopping\\fr.jpg' align= left>");
pw.print("<br><br><br><br><br><br><br><br>");
pw.print("<img src='D:\\onlineshopping\\diwali.jpg' align=right >");

pw.print("</body>");
pw.print("</html>");

}
}
Registration1.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class registration1 extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
pw.print("<html>");
pw.print("<body>");
pw.print("<form action='http://localhost:8080/servlet/newuser1'>");
pw.print("<p align=right> " + " <a
href='http://localhost:8080/servlet/front'> " + "<font
color=#15317E><b> " + " HOME</a> " + " &nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/aboutus'> " + " <font
color=#15317E><b> " + " ABOUT US</a> " + " &nbsp;&nbsp; " + "
<a href=> " + " <font color=#15317E><b> " + " FEEDBACK</a> " +
" </p> " + " <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4>");
pw.print("<img src='D:\\onlineshopping\\sidelogo.jpg' align=left> " +
" <img src='D:\\onlineshopping\\sidelogo.jpg' align=right>" + "
<br><br>");

pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<font size=10 color=#347C17 ><b> " + " <i>ONLINE
SHOPPING</i></b> " + " </font>");
pw.print("<hr width=100% color=orange size=2 >");
pw.print("<font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/registration1'> " + " New
user</a> " + " &nbsp;&nbsp;" + " <font color=#15317E> " + " <a
href='http://localhost:8080/servlet/regis'><b> " + " Registered
user</a> " + " &nbsp;&nbsp; " + " <font color=#15317E> " + " <a
href='http://localhost:8080/servlet/accountinfo'><b> " + "
MyAccount</a>");
pw.print("<hr width=100% color=#3BB9FF size=10 >");
pw.print("<marquee > " + " <font color=orange size=3><b> " + "
Register To Yourself " + " </font> " + " </marquee> " + "
<br><br><br><br>");
pw.print("</table>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left>" + " <p
align=center><font color=blue size=4>" + " Providing accurate
contact details are important to have smooth transaction" + "</font>
</p>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left
idth=190>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4 > " + "Electronics & " + "
&nbsp;&nbsp;&nbsp; Computer " + "</a> " + "</td> " + "</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/art '> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Art & Paintings " +
"</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");

pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/book '>


" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Books & Magazines "
+ "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/mobile
'> " + "<img src='D:\\onlineshopping\\arw.jpg'
align=left hight=20 width=20> " + "<font color=white size=4> " +
"Mobile & Cameras<b> " + "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a
href='http://localhost:8080/servlet/game.html '> " + "<font
color=white size=4 > " + "<img src='D:\\onlineshopping\\arw.jpg'
align=left hight=20 width=20> " + "Games<b> " + "</a> " + "</td>");
pw.print("</tr> " + "</table> ");
pw.print("<table border=0 align=center>");
pw.print("<th>" + "<font color=blue size=4>" + "Tell us about
yourself - All fields are required" + "</font>" + "</th>");
pw.print("<tr>" + "<td>" + "<b>First Name </b>" + "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "<input type=text
name=t1>" + "</td>" + "</tr>");
pw.print("<tr>" + "<td> " + "<b>Last Name </b>" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "<input
type=text name=t2>" + "</td>" + "</tr>");
pw.print("<tr>" + "<td>" + "<b>Email address </b>" + " <input
type=text name=t3>" + "</td>" + "</tr>");
pw.print("<tr>" + "<td>" + "<b>Contact no</b>" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "<input
type=text name=t4>" + "</td>" + "</tr>");
pw.print("<tr>" + "<td>" + "<b>Home address</b>" + "<textarea
name=t5 rows=3 cols=20></textarea>" + "</td>" + "</tr>");

pw.print("<tr>" + "<td>" + "<b>City</b>" +


"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "<input type=text
name=t6>" + "</td>" + "</tr>");
pw.print("<th>" + "<font color=blue size=4>" + "Choose your userID
and password - All fields are required" + "</font>" + "</th>");
pw.print("<tr>" + "<td>" + "<b>userID</b>" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;" + "<input type=password name=t7>" + "</td>" +
"</tr>");
pw.print("<tr>" + "<td>" + "<b>Password</b>" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "<input
type=password name=t8>" + "</td>" + "</tr>");
pw.print("<tr>" + "<td>" + "<b>Confirm Password</b>" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
+ "<input type=password name=t9>" + "</td>" + "</tr>");
pw.print("</table>" + "<br>");
pw.print("<pre> " + " <input type=submit
value=Register
style=color:white;background:blue>" + "</pre>");
pw.print("</form>");
pw.print("</body>");
pw.print("</html>");
}
}
Regis.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class regis extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res) throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
pw.print("<html>");
pw.print("<body>");
pw.print("<form action='http://localhost:8080/servlet/login2'> ");
pw.print("<p align=right> " + " <a
href='http://localhost:8080/servlet/front'>" + "<font
color=#15317E><b> HOME</a> " + " &nbsp;&nbsp" + "<a href=>
" + " <font color=#15317E><b> " + " ABOUT US</a> " + "
&nbsp;&nbsp " + " <a href=" + " <font color=#15317E><b> " + "
FEEDBACK</a> " + " </p> ");
pw.print("<img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4>" + "<br>");
pw.print("<marquee bgcolor=#347C17> " + "<font color=white
size=4><b>Welcome to online Shopping</font> " +
"</marquee><br><br>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left> "
+"<br> " + "<br>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left
width=190>");
pw.print("<tr>");
pw.print("<td> " + "<b> " + "<a
href='http://localhost:8080/servlet/ece'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20> " + "
<font color=white size=4 >Electronics & " + " &nbsp;&nbsp;&nbsp;
" + "Computer</a></td> " );
pw.print("</tr> ");
pw.print("<td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + " <font color=white size=4>Art & Paintings</a> " + "
</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + " <font color=white size=4>Books & Magazines</a> " +
"</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a
href='http://localhost:8080/servlet/mobile'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20> " + "
<font color=white size=4>Mobile & Cameras<b></a> " + " </td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + " <a
href='http://localhost:8080/servlet/game'>" + " <font color=white
size=4 > " + "<img src='D:\\onlineshopping\\arw.jpg' align=left
hight=20 width=20>Games<b></a> " + " </td>");
pw.print("</tr>");
pw.print("</table>");
pw.print("<table border=0 align=center>");
pw.print("<tr> " + " <td><b>userID</b> " + "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + " <input
type=password name=t1> " + " </td> " + " </tr>");
pw.print("<tr> " + " <td><b>Password</b>&nbsp;&nbsp;&nbsp;" +
" <input type=password name=t2> " + " </td> " + "</tr> " + "<tr> "
+ " <td>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print(" <font color=red> " + "<a
href='http://localhost:8080/servlet/aboutus'> " + " Forget Your
Password ? " + " </a> " + " </font> " + " </tr> " + " <td>");
pw.print("<tr> " + " <td>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<font color=red> " + " <a
href='http://localhost:8080/servlet/changepass'> " + "Change
Password ? " + " </a> " + " </font> " + " </tr> " + " <td>");
pw.print("</table>");
pw.print("<pre>" + " <input type=submit
name=b1 value=Signin style='color:white;background:#347C17'>");
pw.print("</form>");
pw.print("</body>");
pw.print("</html>");
}
}
Login2.java
import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class login2 extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
int i=0;

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
Statement stat1,stat2,stat3,stat4;
stat1=con.createStatement();
stat2=con.createStatement();
stat3=con.createStatement();
stat4=con.createStatement();
stat1.executeUpdate("delete from usertemp");
stat2.executeUpdate("delete from banktemp");
stat3.executeUpdate("delete from totaltemp");
stat4.executeUpdate("delete from itemtemp");

PreparedStatement pstat=con.prepareStatement("select * from


newuser where userID=? and Password=?");
pstat.setString(1,req.getParameter("t1"));
pstat.setString(2,req.getParameter("t2"));
ResultSet rest =pstat.executeQuery();

while(rest.next())
{
i++;
}}
catch(Exception e)
{
pw.print(e);
}
String ss;
if(i>0)
{
ss=req.getParameter("t1");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");

PreparedStatement pstat1=con.prepareStatement("select FirstName


from newuser where userID=?");
pstat1.setString(1,ss);
ResultSet rest =pstat1.executeQuery();
rest.next();

String f=rest.getString(1);
PreparedStatement pstat2=con.prepareStatement("insert into
usertemp values(?,?)");
pstat2.setString(1,ss);
pstat2.setString(2,f);
pstat2.executeUpdate();

pw.print("<html>");
pw.print("<body>");pw.print("<p align=right> " + "
<http://localhost:8080/servlet/front>" + "<font color=#15317E><b> "
+ " HOME</a> " + " &nbsp;&nbsp;");
pw.print("<a href=> " + " <font color=#15317E><b> " + " ABOUT
US</a> " + " &nbsp;&nbsp; " + " <a href=> " + " <font
color=#15317E><b> " + " FEEDBACK</a> " + " </p> " + " <img
src='d:\\onlineshopping\\india.jpg'> ");
pw.print("<pre>" + " <font
color=blue size=4>" + "<b>");pw.print("Welcome</b>&nbsp;" + f);
pw.print(" </font> " + " </pre>");
pw.print(" <hr width=100% color=#3BB9FF size=4>");
pw.print("<img src='D:\\onlineshopping\\sidelogo.jpg' align=left> " +
" <img src='D:\\onlineshopping\\sidelogo.jpg' align=right>" + "
<br><br>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<font size=10 color=#347C17 ><b> " + " <i>ONLINE
SHOPPING</i></b> " + " </font>");
pw.print("<hr width=100% color=orange size=2 >");
pw.print("<font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/registration1'> " + " New user</a>
" + " &nbsp;&nbsp;" + " <font color=#15317E> " + " <a
href='http://localhost:8080/servlet/regis'><b> " + " Registered
user</a> " + " &nbsp;&nbsp; " + " <font color=#15317E> " + " <a
href='http://localhost:8080/servlet/accountinfo'><b> " + "
MyAccount</a>");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; " + " <font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");
pw.print("<hr width=100% color=#3BB9FF size=10 >");
pw.print("<marquee > " + " <font color=orange size=3><b> " + "
Welcome to Online Shopping " + " </font> " + " </marquee> " + "
<br>")pw.print("</table>");
pw.print("<table border=2 bgcolor= white align=right cellpadding=2
cellspacing=2 >");
pw.print("<th> " + " <font size=6 color=#347C17><b> " +
"Electronics goods " + "</font> " + " </th>");
pw.print("<tr> " + "<td> " + " <a
href='d:\\onlineshopping\\ece.html'> " + "<img
src='D:\\onlineshopping\\tv1.jpg'> " + "</a> ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='d:\\onlineshopping\\mobile.html'> " + "<img
src='D:\\onlineshopping\\mb2.jpg'></a>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='d:\\onlineshopping\\dvd.html'> " + "<img
src='D:\\onlineshopping\\dvd2.jpg'> " + " </a> ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='d:\\onlineshopping\\ece.html'> " + "<img
src='D:\\onlineshopping\\lp1.jpg'> " + "</a> " + "</td> " + "</tr>");
pw.print("<th> " + "<font size=6 color=#347C17><b> " + "Art &
Games</b> " + "</font>");
pw.print("<tr> " + "<td> " + "<a href='d:\\onlineshopping\\art.html'>
" + "<img src='D:\\onlineshopping\\art1.jpg'> " + "</a>");
pw.print("<a href='d:\\onlineshopping\\games.html'> " + "<img
src='D:\\onlineshopping\\gm1.jpg'> " + "</a>");
pw.print("<a href='d:\\onlineshopping\\art.html'> " + "<img
src='D:\\onlineshopping\\art2.jpg'> " + "</a>");
pw.print("<a href='d:\\onlineshopping\\games.html'> " + "<img
src='D:\\onlineshopping\\gm2.jpg'> " + "</a> " + "</td> " + "</tr> "
+ "</table>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left> " +
"<br><br><br>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left
width=190>");pw.print("<tr>");

pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/ece'> "


+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4 > " + "Electronics & " + "
&nbsp;&nbsp;&nbsp; Computer " + "</a> " + "</td> " + "</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/art '> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Art & Paintings " +
"</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/book '>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Books & Magazines "
+ "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/mobile
'> " + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Mobile & Cameras<b>
" + "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a
href='http://localhost:8080/servlet/game.html '> " + "<font
color=white size=4 > " + "<img src='D:\\onlineshopping\\arw.jpg'
align=left hight=20 width=20> " + "Games<b> " + "</a> " + "</td>");
pw.print("</tr> " + "</table> " +
"<br><br><br><br><br><br><br><br><br><br>");
pw.print("<img src='d:\\onlineshopping\\fr.jpg' align= left>");
pw.print("<br><br><br><br><br><br><br><br>");
pw.print("<img src='D:\\onlineshopping\\diwali.jpg' align=right >");
}

catch(Exception e1)
{
System.out.println(e1);
}}
else
{
pw.print("userID and Password does not match");
}
}
}
Changepass.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class changepass extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res) throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
pw.print("<html>");
pw.print("<body>");
pw.print("<form action=" + "http://localhost:8080/servlet/newpass" +
">");
pw.print(" <p align=right>" + " <a
href='http://localhost:8080/servlet/front'> " + "<font color=#15317E>"
+ "<b> " + "HOME " + " </a> " + "&nbsp;&nbsp;"
+ "<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E>" + "<b> " + " ABOUT US " + " </a> " +
"&nbsp;&nbsp" + "</font>" + "<font color=#15317E>" + "<b> " +
"FEEDBACK" + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print(" <br> ");
pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <br> ");
pw.print(" <br> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");

pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/ece'> "


+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4 >Electronics &
&nbsp;"+"&nbsp;&nbsp;Computer</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Art & Paintings</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b>" + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a
href='http://localhost:8080/servlet/mobile'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td> " + "<a href='http://localhost:8080/servlet/game'> " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print("</table> ");
pw.print("<center>");
pw.print(" <b> " + "<font color=blue> " +
"&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&n
bsp;&nbsp;&nbsp&nbsp;&nbsp;" + "LoginID </font> " + "<input
type=text name=t1> ");
pw.print("<br>");
pw.print(" <b> " + "<font color=blue> " +
"&nbsp;&nbsp;&nbsp;&nbsp; " + " Old Password </font>" +
"<input type=password name=t2> ");
pw.print("<br>");
pw.print(" <b> " + "<font color=blue> " + "&nbsp;&nbsp;&nbsp; " +
" New Password </font>" + "<input type=password name=t3> ");
pw.print("<br>");
pw.print("<br>");
pw.print("<br>");

pw.print(" <input type=submit value=changepassword


style=color:white;background:blue name=b1> ");
pw.print("</center>");
pw.print(" </form>");
pw.print("</body>");
pw.print("</html>");
}
}

Newpass.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class newpass extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
int i=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");

PreparedStatement pstat=con.prepareStatement("select * from


newuser where userID=? and Password=?");

pstat.setString(1,req.getParameter("t1"));
pstat.setString(2,req.getParameter("t2"));
ResultSet rest =pstat.executeQuery();

while(rest.next())
{
i++;
}

if(i>0)
{

pstat=con.prepareStatement("update newuser set Password=? where


userID=?" );
pstat.setString(1,req.getParameter("t3"));
pstat.setString(2,req.getParameter("t1"));

pstat.executeUpdate();

pw.print("<html>");
pw.print("<body>");
pw.print("<form action='http://localhost:8080/servlet/login2'> ");
pw.print("<p align=right> " + " <a
href='d:\\onlineshopping\\front.html'>" + "<font color=#15317E><b>
HOME</a> " + " &nbsp;&nbsp" + "<a href=> " + " <font
color=#15317E><b> " + " ABOUT US</a> " + " &nbsp;&nbsp " + "
<a href=" + " <font color=#15317E><b> " + " FEEDBACK</a> " + "
</p> ");
pw.print("<img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4>" + "<br>");
pw.print("<marquee bgcolor=#347C17> " + "<font color=white
size=4><b>Welcome to online Shopping</font> " +
"</marquee><br><br>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left> " +
"<br> " + "<br>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left
width=190>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + " <font color=white size=4 >Electronics & " + "
&nbsp;&nbsp;&nbsp; " + "Computer</a></td> " );
pw.print("</tr> ");
pw.print("<td><b> " + "<a
href='http://localhost:8080/servlet/art'><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20> " + "
<font color=white size=4>Art & Paintings</a> " + " </td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + " <font color=white size=4>Books & Magazines</a> " +
"</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a
href='http://localhost:8080/servlet/moblie'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20> " + "
<font color=white size=4>Mobile & Cameras<b></a> " + " </td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + " <a href='http://localhost:8080/servlet/game'>
" + " <font color=white size=4 > " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20>Games<b></a> " + " </td>");
pw.print("</tr>");
pw.print("</table>");
pw.print("<table border=0 align=center>");
pw.print("<tr> " + " <td><b>userID</b> " + "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + " <input
type=password name=t1> " + " </td> " + " </tr>");
pw.print("<tr> " + " <td><b>Password</b>&nbsp;&nbsp;&nbsp;" +
" <input type=password name=t2> " + " </td> " + "</tr> " + "<tr> "
+ " <td>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<font color=red> " + " Forget Your Password ? " + "
</font> " + " </tr> " + " <td>");
pw.print("<tr> " + " <td>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<font color=red> " + " <a
href='http://localhost:8080/servlet/changepass'> " + "Change
Password ? " + " </a> " + " </font> " + " </tr> " + " <td>");
pw.print("</table>");
pw.print("<pre>" + " <input type=submit
name=b1 value=Signin style='color:white;background:#347C17'>");
pw.print("</form>");

pw.print("</body>");
pw.print("</html>");
}
else
{
pw.print("Old Password and ID does not match.");

}
}
catch(Exception e1)
{
}
}
}
Accountinfo.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;
import java.util.Date;
import java.text.*;
public class accountinfo extends GenericServlet

public void service(ServletRequest req,ServletResponse res) throws


IOException,ServletException

res.setContentType("text/html");
PrintWriter pw=res.getWriter();
pw.print("<html>");
pw.print("<body>");
pw.print("<form action=" + "http://localhost:8080/servlet/myaccount"
+ ">");
pw.print(" <html> ");
pw.print(" <body> ");
pw.print("<form action=" + "http://localhost:8080/servlet/last" +
">");
pw.print(" <p align=right>" + " <a
href='http://localhost:8080/servlet/front'> " + "<font color=#15317E>"
+ "<b> " + "HOME " + " </a> " + " &nbsp;&nbsp;"
+ "<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E>" + "<b> " + " ABOUT US " + " </a> " +
"&nbsp;&nbsp" + "</font>" + "<font color=#15317E>" + "<b> " +
"FEEDBACK" + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print(" <br> ");
pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <center> " + "<font color=orange>" + "<b>"+ " Fill these
information if you want to view your account" + "</b>" + "</font>" +
"</center> ");
pw.print(" <br> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4 >Electronics &
&nbsp;"+"&nbsp;&nbsp;Computer</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Art & Paintings</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a
href='http://localhost:8080/servlet/moblie'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td> " + "<a href='http://localhost:8080/servlet/game'> " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print("</table> ");

pw.print("<center>");
pw.print(" <b> " + "<font color=blue> " +
"&nbsp;&nbsp;&nbsp;&nbsp" + "LoginID </font> " + "<input
type=text name=t1> ");
pw.print("<br>");
pw.print(" <b> " + "<font color=blue> " + "&nbsp;&nbsp; " +
"Password </font>" + "<input type=password name=t2> ");
pw.print("<br>");
pw.print("<br>");
pw.print(" <input type=submit value=view
style=color:white;background:blue name=b1> ");
pw.print("</center>");
pw.print("</body>");
pw.print("</html>");

}
}
Myaccount.java
import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class myaccount extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
int i=0;

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat=con.prepareStatement("select * from
newuser where userID=? and Password=?");

pstat.setString(1,req.getParameter("t1"));
pstat.setString(2,req.getParameter("t2"));
ResultSet rest =pstat.executeQuery();

while(rest.next())
{
i++;
}

if(i>0)
{
String s=req.getParameter("t1");
pstat=con.prepareStatement("select Orderno , Date, ItemName ,
Quantity from purchase where userID=? ");
pstat.setString(1,s);
ResultSet rst1=pstat.executeQuery();

pw.print("<html>");
pw.print("<body>");
pw.print("<p align=right> " + " <a
href=http://localhost:8080/servlet/front>" + "<font
color=#15317E><b> " + " HOME</a> " + " &nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/aboutus'> " + " <font
color=#15317E><b> " + " ABOUT US</a> " + " &nbsp;&nbsp; " + "
<a href=> " + " <font color=#15317E><b> " + " FEEDBACK</a> " +
" </p> " + " <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4>");
pw.print("<img src='D:\\onlineshopping\\sidelogo.jpg' align=left> " +
" <img src='D:\\onlineshopping\\sidelogo.jpg' align=right>" + "
<br><br>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<font size=10 color=#347C17 ><b> " + " <i>ONLINE
SHOPPING</i></b> " + " </font>");
pw.print("<hr width=100% color=orange size=2 >");
pw.print("<font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/registration1'> " + " New
user</a> " + " &nbsp;&nbsp;" + " <font color=#15317E> " + " <a
href='http://localhost:8080/servlet/regis'><b> "
+ " Registered user</a> " + " &nbsp;&nbsp; " + " <font
color=#15317E> " + " <a
href='http://localhost:8080/servlet/accountinfo'><b> " + "
MyAccount</a>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + " <font
color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");
pw.print("<hr width=100% color=#3BB9FF size=10 >");
pw.print("<marquee > " + " <font color=orange size=3><b> " + "
Welcome to Online Shopping " + " </font> " + "
</marquee> " + " <br>");
pw.print("</table>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left> " );
pw.print("<font color=orange size=4> " + "Your Account information
is- " + "</font>");
pw.print("<br><br>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190
align=left>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4 > " + "Electronics & " + "
&nbsp;&nbsp;&nbsp; Computer " + "</a> " + "</td> " + "</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/art '> "
+ "<img src='D:\\onlineshopping\\arw.jpg'

align=left hight=20 width=20> " + "<font color=white size=4> " + "Art


& Paintings " + "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/book '>
" + "<img src='D:\\onlineshopping\\arw.jpg'

align=left hight=20 width=20> " + "<font color=white size=4> " +


"Books & Magazines " + "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/mobile
'> " + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Mobile & Cameras<b>
" + "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a
href='http://localhost:8080/servlet/game.html '> " + "<font
color=white size=4 > " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "Games<b> " + "</a> " + "</td>");
pw.print("</tr> " + "</table> ");
pw.print("<table border=4 bordercolor=orange cellpadding=8
align=center>" );
pw.print("<tr>");
pw.print("<td>");
pw.print("Orderno" + "</td>" + "<td>");
pw.print("Date" + "</td>" + "<td>");
pw.print("ItemName" + "</td>" + "<td>");
pw.print("Quantity" + "</td>" + "</tr>");

while(rst1.next())

pw.print("<tr>");
pw.print("<td>");

pw.print(rst1.getString(1) + "</td>" + "<td>");


pw.print(rst1.getString(2)+"</td>" + "<td>");
pw.print(rst1.getString(3)+"</td>" + "<td>" ) ;
pw.print(rst1.getString(4)+"</td>" + "</tr>" );

pw.print("</table>") ;

else
{

pw.print("userid and password does not match.");


}
}
catch(Exception e4)
{
pw.print(e4);
}
}
}
Ece.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;
public class ece extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

pw.print("<html>");
pw.print("<body><p align=right> " + "<a
href='http://localhost:8080//servlet//front'> " + "<font
color=#15317E><b> " + "HOME</a> " + "&nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E><b>" + "ABOUT US " + "</a> " + "&nbsp;&nbsp; "
+ "<a href='http://localhost:8080//servlet//feedback'> " + "<font
color=#15317E><b>" + "FEEDBACK</a> " + "</p>");
pw.print( "<img src='d:\\onlineshopping\\india.jpg'>");
pw.print("<hr width=100% color=#3BB9FF size=4>");
pw.print("<marquee bgcolor=#4E4848> " + " <font color=white font
size=4> " + "Electronics & Computer</font> " + "</marquee>");
pw.print("<br> " + " <br>");
pw.print("<img src='d:\\onlineshopping\\up.gif' align=right> " +
"<br> " + "<br>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left> " +
"<br> " + "<br>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left
width=190>");
pw.print("<tr>");

pw.print("<td><b> " + "<a href='http://localhost:8080/servlet/ece'> "


+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4 > " + "Electronics & " +
"&nbsp;&nbsp;&nbsp; " + "Computer</a> " + "</td> " + "</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Art & Paintings " +
"</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Books & Magazines "
+ "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a
href='http://localhost:8080/servlet/mobile'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20> " +
"<font color=white size=4> " + "Mobile & Cameras<b> " + "</a> " +
"</td>");
pw.print("</tr>");
pw.print("<td> " + "<a href='http://localhost:8080/servlet/game'> " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Games<b> " + "</a> "
+ "</td>");
pw.print("</tr>");
pw.print("</table>");
pw.print("<table border=1 bgcolor= #FDEEF4 align=left>");
pw.print("<tr>");
pw.print("<th> " + "<img src='d:\\onlineshopping\\tv.jpg' align=left>
" + "<a href='http://localhost:8080/servlet/tv1'> " + "<font color=dark
orange> " + "TELEVISION<br> " + "</font> " + "<pre> ");
pw.print("Sony Bravia Series LCD " + " <br> " + " TVs Panasonic
Viera " + " <br> " + " Series LCD TVs ");

pw.print("</th>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<img src='d:\\onlineshopping\\tv.jpg' align=left>
" + "<br> " + "<a href='http://localhost:8080/servlet/tv2'> " + "<pre>
" );
pw.print("Philips Flat Screen Colour " + " <br> " + "TVs Videocon /
" + " <br> " + " Sansui Colour TVs " + "</a> " + "</td> " + "</tr>");
pw.print("<tr>");
pw.print("<th> " + "<img src='d:\\onlineshopping\\musicp1.jpg'
align=left> " + "<font color=dark orange> " + "MUSIC players<br> "
+ "</font> " + "<pre> " + "<a
href='http://localhost:8080/servlet/mp1'> ");
pw.print("TouchScreen iPod " + "<br> " + " Altec Lancing");
pw.print("iPod Accessories " + " </a>");
pw.print("</th>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<img src='d:\\onlineshopping\\musicp2.jpg'
align=left> " + "<br> " + "<pre> " + "<a
href='http://localhost:8080/servlet/mp2'>");
pw.print("Sony Walkman Series " + "<br> " + " Music Players " +
"<br> " + " Portable " + "<br> " + " Media Players " + "</a> " +
"</td> " + "</tr>");
pw.print("</table>");
pw.print("<table border=1 bgcolor= #C6DEFF align=right>");
pw.print("<tr>");
pw.print("<th> " + "<img src='d:\\onlineshopping\\dvd1.jpg'
align=left> " + "<font color=dark orange> " + "<a
href='http://localhost:8080/servlet/dv1'>DVD players<br> " + "
</font> ");
pw.print("<pre> " + "Philips Home DVD " + "<br> " + " Players
Videocon Home " + "<br> " + " DVD Players " + "</a> ");
pw.print("</th>");
pw.print("</tr>");

pw.print("<tr>");
pw.print("<td> " + "<img src='d:\\onlineshopping\\dvd2.jpg'
align=left> " + "<br> " + "<pre> " + "<a
href='http://localhost:8080/servlet/dv2'> ");
pw.print(" Philips Portable DVD " + "<br> " + " Players Coby 7 " +
"<br> " + " Portable DVD Player " + " </a>");
pw.print("</td> " + "</tr>");
pw.print("<tr>");
pw.print("<th> " + "<img src='d:\\onlineshopping\\car1.jpg'
align=left> "+ "<font color=dark orange>");
pw.print("In Car Entertainment<br> " + "</font> " + "<pre> " + "<a
href='http://localhost:8080/servlet/car1'>");
pw.print( " Sony Car Stereos " + "<br> " + " @ Rs2999 Car Speakers
" + "<br> " + " & Woofers@Rs1240 " + "</a>");
pw.print("</th>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<img src='d:\\pp1\\car2.jpg' align=left><br> " +
"<pre> " + "<a href='http://localhost:8080/servlet/car2'> ");
pw.print("Car Displays Starting@ " + "<br> " + " Rs3199 Car GPS "
+ "<br> " + " Navigators " + "</a> " + "</td> " + "</tr> " +
"</table>");
pw.print("<br><br><br><br><br><br><br><br><br><br><br><br>
");
pw.print("</body>");
pw.print("</html>");
}
}
Tv21.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class tv21 extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

pw.print("<html>");
pw.print("<body>");
pw.print("<form action='http://localhost:8080/servlet/pay'
name=f1>");
pw.print("<b> " + "<img src='d:\\onlineshopping\\phl11.jpg'
align=left> " + "<br><br><br> " );
pw.print("<pre> " + " <font color=red size=5> " + "Offer rice
:Rs. 11790</font> " + "<br> " + "<br>");
pw.print(" MRP : Rs. 12990 " + "<br>");
pw.print(" You Save : Rs. 1200(9%) " + "<br>");
pw.print(" EMI Available : Rs.1,965 for 6 months " +
"<br>");
pw.print(" Warranty : Not Applicable " + "<br>");
pw.print(" Return Policy :Applicable ( 10 days Return Policy)
" + "<br>");
pw.print(" Shipping Time : Ships in 10 working days " +
"<br>");
pw.print(" Shipping Charges : 0.00 " + "<br>");

pw.print(" Shipping Location : All Cities " + "<br>");


pw.print(" Seller : <font color=blue> Philips Electronics
India Ltd. " + "<br> " + "</pre>");
pw.print("<input type=hidden value=PT5507/94 name=h1>");
pw.print("<input type=hidden value=11790 name=h2>");
pw.print("<pre> <font color=blue>
<b>Quantity</b></font> <input type=text name=t1 size=3></pre>");
pw.print("<pre> <input
type=submit value=Buy style='color:white;background:green'
name=b1></pre>");
pw.print("</form> ");
pw.print("</body>");
pw.print("</html>");
}
}
Art.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;
public class art extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

pw.print("<html>");
pw.print("<body><p align=right> " + "<a
href='http://localhost:8080/servlet/front'> " + "<font
color=#15317E><b> " + "HOME</a> " + "&nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E><b>" + "ABOUT US</a> " + "&nbsp;&nbsp; " + "<a
href='http://localhost:8080/servlet/feedback'> " + "<font
color=#15317E><b>" + "FEEDBACK</a> " + "</p>");
pw.print( "<img src='d:\\onlineshopping\\india.jpg'>");
pw.print("<hr width=100% color=#3BB9FF size=4>");
pw.print("<marquee bgcolor=#4E4848> " + " <font color=white font
size=4> " + "Electronics & Computer</font> " + "</marquee>");
pw.print("<br> " + " <br>");
pw.print("<img src='d:\\onlineshopping\\up.gif' align=right> " +
"<br> " + "<br>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left> " +
"<br> " + "<br>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left
width=190>");
pw.print("<tr>");pw.print("<td><b> " + "<a
href='http://localhost:8080/servlet/ece'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20> " +
"<font color=white size=4 > " + "Electronics & " +
"&nbsp;&nbsp;&nbsp; " + "Computer</a> " + "</td> " + "</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Art & Paintings " +
"</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Books & Magazines "
+ "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td><b> " + "<a
href='http://localhost:8080/servlet/mobile'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20> " +
"<font color=white size=4> " + "Mobile & Cameras<b> " + "</a> " +
"</td>");
pw.print("</tr>");
pw.print("<td> " + "<a href='http://localhost:8080/servlet/game'> " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Games<b> " + "</a> "
+ "</td>");
pw.print("</tr>");
pw.print("</table>");
pw.print("<table border=1 bgcolor= #FDEEF4 align=left>");
pw.print("<tr>");
pw.print("<th> " + "<img
src='d:\\onlineshopping\\artistic1_21Aug[1].GIF' align=left> " + "<a
href='http://localhost:8080/servlet/art1'> " + "<font color=dark
orange> " + "Artistic Wall piecies <br> " + "</font> " + "<pre> ");
pw.print("ArtPanel-Hanger1 Rs. 254 ");
pw.print("</th>");

pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<img src='d:\\onlineshopping\\art2.gif'
align=left> " + "<br> " + "<a href='http://localhost:8080/servlet/art2'>
" + "<pre> " );
pw.print("Art Panel-Hanger 2 Rs. 212 " + "</a> " + "</td> " +
"</tr>");
pw.print("<tr>");
pw.print("<th> " + "<img src='d:\\onlineshopping\\art3.jpg'
align=left> " + "<font color=dark orange> " + "Sculpture<br> " +
"</font> " + "<pre> " + "<a href='http://localhost:8080/servlet/art3'>
");
pw.print("Brass Art Panel Rs.2549");
pw.print("</th>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<img src='d:\\onlineshopping\\art4.jpg'
align=left> " + "<br> " + "<pre> " + "<a
href='http://localhost:8080/servlet/art4'>");
pw.print("Cross Ganesha Rs. 2500 " + "</a> " + "</td> " + "</tr>");
pw.print("</table>");
pw.print("<table border=1 bgcolor= #C6DEFF align=right>");
pw.print("<tr>");
pw.print("<th> " + "<img src='d:\\onlineshopping\\art5.jpg'
align=left> " + "<font color=dark orange> " + "<a
href='http://localhost:8080/servlet/art5'> " + " Art Mirrors<br> " + "
</font> ");
pw.print("<pre> " + "WroughtIronMirrorRs.5250 " + "</a> ");
pw.print("</th>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<img src='d:\\onlineshopping\\art6.jpg'
align=left> " + "<br> " + "<pre> " + "<a
href='http://localhost:8080/servlet/art6'> ");
pw.print(" Art Mirror(H) Rs. 1444 " + " </a>");
pw.print("</td> " + "</tr>");

pw.print("<tr>");
pw.print("<th> " + "<img src='d:\\onlineshopping\\hand1.jpg'
align=left> "+ "<font color=dark orange>");
pw.print("Hand Made Bags" + "</font> " + "<pre> " + "<a
href='http://localhost:8080/servlet/art7'>");
pw.print( " BrocadeJewelleryPouch Rs. 150 " + "</a>");
pw.print("</th>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<img src='d:\\pp1\\hand2.jpg' align=left><br> "
+ "<pre> " + "<a href='http://localhost:8080/servlet/art8'> ");
pw.print("Black Brocade Fold " + "</a> " + "</td> " + "</tr> " +
"</table>");
pw.print("<br><br><br><br><br><br><br><br><br><br><br><br>
");
pw.print("</body>");
pw.print("</html>");
}
}
Art4.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class art4 extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

pw.print("<html>");
pw.print("<body>");
pw.print("<form action='http://localhost:8080/servlet/pay'
name=f1>");
pw.print("<b> " + "<img src='d:\\onlineshopping\\a4.jpg' align=left>
" + "<br><br><br> " );
pw.print("<pre> " + " <font color=red size=5> " + "Offer Price
:Rs. Rs. 2500</font> " + "<br> " + "<br>");
pw.print(" EMI Available : Rs.833 for 3 months " + "<br>");
pw.print(" Warranty : Not Applicable " + "<br>");
pw.print(" Return Policy :Applicable ( 10 days Return Policy)
" + "<br>");
pw.print(" Shipping Time : Ships in 14 working days " +
"<br>");
pw.print(" Shipping Charges : 250.00 " + "<br>");
pw.print(" Shipping Location : All Cities " + "<br>");
pw.print(" Seller : <font color=blue> Harmony Decor Pvt.
Ltd. " + "<br> " + "</pre>");

pw.print("<input type=hidden value=CrossGanesha name=h1>");


pw.print("<input type=hidden value=2500 name=h2>");

pw.print("<pre> <font color=blue>


<b>Quantity</b></font> <input type=text name=t1 size=3></pre>");
pw.print("<pre> <input type=submit value=Buy
style='color:white;background:green' name=b1></pre>");
pw.print("</form>");

pw.print("</body>");
pw.print("</html>");
}
}
Pay.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class pay extends GenericServlet


{
Connection con;
int m=0,n=0;
public void service(ServletRequest req,ServletResponse res)throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat1=con.prepareStatement("insert into
itemtemp(ItemName,Price,Quantity,subtotal) values(?,?,?,?)");
pstat1.setString(1,req.getParameter("h1"));
pstat1.setInt(2,Integer.parseInt(req.getParameter("h2")));
pstat1.setInt(3,Integer.parseInt(req.getParameter("t1")));
int j=Integer.parseInt(req.getParameter("h2"));
int k=Integer.parseInt(req.getParameter("t1"));
int l=(j*k);
pstat1.setInt(4,l);
pstat1.executeUpdate();
}
catch(Exception e)
{
System.out.println(e);
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat=con.prepareStatement("select sum(subtotal)
from itemtemp");
ResultSet rest=pstat.executeQuery();
rest.next();

int m=rest.getInt(1);

PreparedStatement pstat2=con.prepareStatement("select total from


totaltemp");
ResultSet rest1=pstat2.executeQuery();
int n=0;

while(rest1.next())
{
n=Integer.parseInt(rest1.getString(1));
}
if(n>0)
{
pstat2=con.prepareStatement("update totaltemp set total=?");
pstat2.setInt(1,m);
pstat2.executeUpdate();
}
else
{
pstat2=con.prepareStatement("insert into totaltemp values(?)");
pstat2.setInt(1,m);
pstat2.executeUpdate();
}
}
catch(Exception e1)
{
System.out.println(e1);
}

pw.print(" <html> ");


pw.print(" <body> ");
pw.print("<form action=" + "http://localhost:8080/servlet/bank" +
">");
pw.print(" <p align=right> " + "<a
href='http://localhost:8080/servlet/front'> " + "<font color=#15317E>"
+ "<b>" + "HOME " + "</a> " + "&nbsp;&nbsp" + "</b>" +
"</font>" +
"<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E>" + "<b>" + "ABOUT US " + " </a> " +
"&nbsp;&nbsp" + "</b>" + "</font>" + " <font color=#15317E>" +
"<b>" + "FEEDBACK" + "</b>" + "</font>" + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print(" <br><br><br> ");
pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <pre> <font color=#B93B8F
size=5><b><u>Method Of Payment</b></u></font></pre> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4 >Electronics &
&nbsp;&nbsp;&nbsp;Computer</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Art & Paintings</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a
href='http://localhost:8080/servlet/moblie'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td> " + "<a href='http://localhost:8080/servlet/game'> " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print(" </table> ");
pw.print(" <pre> <input type=radio name=option
value=CreditCard><font color=blue size=4><b> Payment by
CreditCard</b></font><br><br></pre> ");
pw.print( "<pre> <input type=radio name=option
value=Cash><font color=blue size=4><b> Payment by
Cash</b></font></pre><br><br></pre>");
pw.print("<input type=hidden name=h1 value=" +
req.getParameter("h1") + ">");
pw.print("<pre> <input type=submit value=Continue
style=color:white;background:green ></pre> ");
pw.print(" </form> ");
pw.print(" </body> ");
pw.print(" </html> ");
}
}
Bank.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class bank extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

String j;

j=req.getParameter("option");
if(j.equals("CreditCard"))
{
try
{

String k="credit";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con1=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat12=con1.prepareStatement("update itemtemp
set ccn=? where itemname=?");
pstat12.setString(1,k);
pstat12.setString(2,req.getParameter("h1"));
pstat12.executeUpdate();
}catch(Exception eee){}

pw.print(" <html> ");


pw.print(" <body> ");
pw.print("<form action=" + "http://localhost:8080/servlet/cmpr" +
">");
pw.print(" <p align=right>" + " <a
href='http://localhost:8080/servlet/front'> " + "<font color=#15317E>"
+ "<b> " + "HOME " + " </a> " + "&nbsp;&nbsp;"
+ "<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E>" + "<b> " + " ABOUT US " + " </a> " + "
&nbsp;&nbsp" + "</font>" + "<font color=#15317E>" + "<b> " +
"FEEDBACK" + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print(" <br> ");
pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <center> " + "<font color=orange>" + "<b>"+"Fill these
information if you want to continue" + "</b>" + "</font>" +
"</center> ");
pw.print(" <br> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4 >Electronics &
&nbsp;"+"&nbsp;&nbsp;Computer</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Art & Paintings</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a
href='http://localhost:8080/servlet/moblie'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td> " + "<a href='http://localhost:8080/servlet/game'> " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print(" </table> ");
pw.print(" <pre> <b>Account Number<input type=password
name=t2></pre> ");
pw.print(" <pre> <b>Creditcard Number</b><input
type=password name=t3></pre> ");
pw.print(" <br> ");
pw.print(" <pre> <input type=submit value=continue
name=b1></pre> ");
pw.print(" </form> ");
pw.print(" </body> ");
pw.print(" </html> ");
}

else
{

Try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat1=con.prepareStatement("update itemtemp
set ccn='cash' where itemname=?");
pstat1.setString(1,req.getParameter("h1"));
pstat1.executeUpdate();
}catch(Exception eee){}

pw.print(" <html> ");


pw.print(" <body> ");
pw.print("<form action=" +
"http://localhost:8080/servlet/anothernewuser" + ">");
pw.print(" <p align=right>" + "<font color=#15317E>" + "<b> " +
"HOME " + " &nbsp;&nbsp;"
+ "<font color=#15317E>" + "<b> " + " ABOUT US " + "
&nbsp;&nbsp" + "</font>" + "<font color=#15317E>" + "<b> " +
"FEEDBACK" + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print(" <br> ");
pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <center> " + "<font color=orange>" + "<b>"+"You get
your Product on this Address if you want to change it then click on
Change address otherwise click on Continue" + "</b>" + "</font>" +
"</center> ");
pw.print(" <br> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");
pw.print(" <td><b><img src='D:\\onlineshopping\\arw.jpg' align=left
hight=20 width=20><font color=white size=4 >Electronics &
&nbsp;"+"&nbsp;&nbsp;Computer</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\art.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Art & Paintings</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\book.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\mobile.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td><img src='D:\\onlineshopping\\arw.jpg' align=left
hight=20 width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print(" </table> ");

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection

con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat1=con.prepareStatement("select userID from
usertemp ");
ResultSet rst=pstat1.executeQuery();
rst.next();
String f=rst.getString(1);

PreparedStatement pstat2=con.prepareStatement("select
FirstName,LastName,Emailaddress,Contactno,Homeaddress, City
from newuser where userID=? ");
pstat2.setString(1,f);
ResultSet rst1=pstat2.executeQuery();
rst1.next();
String g=rst1.getString(1);
String h=rst1.getString(2);
String p=rst1.getString(3);
String k=rst1.getString(4);
String r=rst1.getString(5);
String b=rst1.getString(6);
pw.print(" <pre>");
pw.print(" <b>" + " Name:-" + "</b>" + "<font size=3 font
color=blue><b> " + g + "</b></font>");
pw.print("<font size=3 font color=blue><b> " + h + "</b></font>" +
"<br>");
pw.print(" <b>" + "Contactno:-" +" </b> " + " <font size=3
font color=blue><b> " + k + "</b></font>" + "<br>");
pw.print(" <b>" + " Emailaddress:-" + " </b> " + " <font
size=3 font color=blue><b>" + p + "</b></font>" + "<br>");
pw.print(" <b>" + " Homeaddress:-" + "</b> " + " <font
size=3 font color=blue><b> " + r + "</b></font>" + "<br>");
pw.print(" <b>" + " City:-" + " </b> " + "<font size=3 font
color=blue><b> " + b +"</b></font>" + "<br>");
pw.print("</pre>");
}
catch(Exception e)
{
System.out.println(e);
}
pw.print("<br>");
pw.print("<br>");
pw.print("<br>");
pw.print("<br>");
pw.print("<pre>");
pw.print(" <input type=Submit
value=Changeaddress style=color:white;background:green
name=b2>");pw.print(" </form> ");
pw.print("<form action=" + "http://localhost:8080/servlet/cash" +
">");
pw.print(" <input type=submit
value=Continue style=color:white;background:green
name=b3>");pw.print(" </form> ");
pw.print("</pre>");
pw.print(" </body> ");
pw.print(" </html> ");
}
}
}
Cmpr.java
import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class cmpr extends GenericServlet


{
Connection con;
ResultSet rest1,rest2,rest3;
public void service(ServletRequest req,ServletResponse res)throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
String[] itemlst=new String[10];
int z=0;
int i=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat1=con.prepareStatement("select * from
account where AN=? and CCN=?");

pstat1.setString(1,req.getParameter("t2"));
pstat1.setString(2,req.getParameter("t3"));

ResultSet rst=pstat1.executeQuery();

while( rst.next())
{
i++;
}
}
catch(Exception e2)
{
}
if(i>0)
{
try
{
PreparedStatement pstat2=con.prepareStatement("insert into
banktemp values(?,?)");

pstat2.setString(1,req.getParameter("t2"));
pstat2.setString(2,req.getParameter("t3"));
pstat2.executeUpdate();

}
catch(Exception e)
{
}

pw.print(" <html> ");


pw.print(" <body> ");
pw.print("<form action=" + "http://localhost:8080/servlet/last" +
">");
pw.print(" <p align=right>" + "<font color=#15317E>" + "<b> " +
"HOME " + " &nbsp;&nbsp;"
+ "<font color=#15317E>" + "<b> " + " ABOUT US " + "
&nbsp;&nbsp" + "</font>" + "<font color=#15317E>" + "<b> " +
"<a href='http://localhost:8080/servlet/feedback'> " + "FEEDBACK "
+ " </a> " + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; " + " <font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");
pw.print(" <br> ");
pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <br> ");
pw.print(" <br> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");

pw.print(" <td><b><img src='D:\\onlineshopping\\arw.jpg' align=left


hight=20 width=20><font color=white size=4 >Electronics &
&nbsp;"+"&nbsp;&nbsp;Computer</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\art.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Art & Paintings</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\book.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\mobile.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td><img src='D:\\onlineshopping\\arw.jpg' align=left
hight=20 width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print(" </table> ");

try
{
Statement stat1=con.createStatement();
Statement stat2=con.createStatement();

ResultSet rest1=stat1.executeQuery("select * from usertemp");


ResultSet rest2=stat2.executeQuery("select * from itemtemp");
rest1.next();

pw.print("<center>");
pw.print("<font color=red>" + rest1.getString(2) + "</font>" + ",You
are transacting on a secure shopping server.");
pw.print("</center>");
pw.print("<br>");
pw.print(" <center> ");
pw.print("<table border=3 bordercolor=orange cellpadding=8>" );
pw.print("<tr>");
pw.print("<td>");
pw.print("ItemName" + "</td>" + "<td>");
pw.print("Price" + "</td>" + "<td>");
pw.print("Quantity" + "</td>" + "<td>");
pw.print("SubTotal" + "</td>" + "</tr>");
z=0;
while(rest2.next())
{
pw.print("<tr>");
pw.print("<td>");
itemlst[z]=rest2.getString(1);

pw.print(itemlst[z] + "</td>" + "<td>");


pw.print(Integer.parseInt(rest2.getString(2))+"</td>" + "<td>");
pw.print(Integer.parseInt(rest2.getString(3))+"</td>" + "<td>" ) ;
pw.print(Integer.parseInt(rest2.getString(4))+"</td>" + "</tr>" );
z++;
}
pw.print("</table>") ;
pw.print("</center>");
}
catch(Exception e)
{
}
pw.print(" <center> ");
pw.print("<br> ");
pw.print("<br> ");
pw.print("<br> ");
pw.print("<br> ");
pw.print("<br> ");
pw.print("<pre> ");pw.print(" <input type=submit
value=Confirm style=color:white;background:#347C17 name=b1>
");pw.print("</form>");
pw.print("<form action=" + "http://localhost:8080/servlet/front" +
">");
pw.print(" <input type=Submit value=AddtoCart
style=color:white;background:green name=b2>");
pw.print("</pre>");
pw.print(" </center> ");
pw.print(" </form> ");

pw.print("<form name=ff action='http://localhost:8080/servlet/del'>");


pw.print("<center>");
pw.print("<select name=s1>");
pw.print("<option value=''>" + "Select Item To Remove");
for (int y=0 ;y<z;y++)
{
pw.print("<option value='" + itemlst[y] + "'>" + itemlst[y]);
}
pw.print("</select>");

pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;");

pw.print("<input type=submit value='To remove , press Refresh


button'style=color:white;background:blue >");
pw.print("</center>");
pw.print("</form>");
}
else
{
pw.print("Information filled are incorrect,fill the correct if you want
to proceed");
}
pw.print("</body> ");
pw.print("</html>");
}
}

Del.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;
import java.util.Date;
import java.text.*;
public class del extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res) throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
/*pw.print("<html>");
pw.print("<body>");

pw.print("<form action='http://localhost:8080/servlet/cmpr'>");
pw.print("<input type=submit value=back>");
pw.print("</form>");
pw.print("</body>");
pw.print("</html>");*/

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat1=con.prepareStatement("delete from
itemtemp where itemname=?");
String ss=req.getParameter("s1");
pstat1.setString(1,ss);
pstat1.executeUpdate();
}catch(Exception dd){}

}
}
Changeadd.java
import java.io.*;
import javax.servlet.*;
import java.sql.*;
public class changeadd extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res) throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
int i=0;

if(req.getParameter("t1").length()==0)
{
pw.print("fill all the information");
}
else if(req.getParameter("t2").length()==0)
{
pw.print("fill all the information");
}

else if(req.getParameter("t3").length()==0)
{
pw.print("fill all the information");
}
else if(req.getParameter("t4").length()==0)
{
pw.print("fill all the information");
}

else
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pss=con.prepareStatement("select * from newuser
where userID=? and Password=?");
pss.setString(1,req.getParameter("t5"));
pss.setString(2,req.getParameter("t6"));
ResultSet rr=pss.executeQuery();

while(rr.next())
{
i++;
}

if(i>0)
{

pss=con.prepareStatement("update newuser set


Emailaddress=?,Contactno=?,Homeaddress=?,City=? where userID=?
and Password=?");
pss.setString(1,req.getParameter("t1"));
pss.setString(2,req.getParameter("t2"));
pss.setString(3,req.getParameter("t3"));
pss.setString(4,req.getParameter("t4"));
pss.setString(5,req.getParameter("t5"));
pss.setString(6,req.getParameter("t6"));
pss.executeUpdate();
pw.print(" <html> ");
pw.print(" <body> ");
pw.print("<form action=" + "http://localhost:8080/servlet/bank" +
">");
pw.print(" <p align=right> " + "<a
href='http://localhost:8080/servlet/front'> " + "<font color=#15317E>"
+ "<b>" + "HOME " + " </a> " + "&nbsp;&nbsp" + "</b>" +
"</font>" +
"<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E>" + "<b>" + "ABOUT US " + "</a> " +
"&nbsp;&nbsp" + "</b>" + "</font>" + " <font color=#15317E>" +
"<b>" + "<a href='http://localhost:8080/servlet/feedback'> " +
"FEEDBACK " + " </a> " + "</b>" + "</font>" + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; " + " <font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");

pw.print(" <br><br><br> ");


pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <pre> <font color=#B93B8F
size=5><b><u>Method Of Payment</b></u></font></pre> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4 >Electronics &
&nbsp;&nbsp;&nbsp;Computer</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Art & Paintings</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a
href='http://localhost:8080/servlet/moblie'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td> " + "<a href='http://localhost:8080/servlet/game'> " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print(" </table> ");
pw.print(" <pre> <input type=radio name=option
value=CreditCard><font color=blue size=4><b> Payment by
CreditCard</b></font><br><br></pre> ");
pw.print( "<pre> <input type=radio name=option
value=Cash><font color=blue size=4><b> Payment by
Cash</b></font></pre><br><br></pre>");
pw.print("<pre> <input type=submit value=Continue
style=color:white;background:green ></pre> ");

pw.print(" </form> ");


pw.print(" </body> ");
pw.print(" </html> ");
}
else
{
pw.print("userID and Password doesnot match");
}
}
catch(Exception e3)
{
}
}

}
}
Last.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;
import java.util.Date;
import java.text.*;
public class last extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res) throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

pw.print(" <html> ");


pw.print(" <body> ");
pw.print(" <p align=right>" + "<font color=#15317E>" + "<b> " +
"HOME " + " </a> " + "&nbsp;&nbsp;"
+ "<font color=#15317E>" + "<b> " + " ABOUT US " + " </a> " +
"&nbsp;&nbsp" + "</font>" + "<font color=#15317E>" + "<b> " +
"FEEDBACK" + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;" + " <font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");

pw.print(" <br> ");


pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <br> ");
pw.print(" <br> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");
pw.print(" <td><b><img src='D:\\onlineshopping\\arw.jpg' align=left
hight=20 width=20><font color=white size=4 >Electronics &
&nbsp;"+"&nbsp;&nbsp;Computer</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\art.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Art & Paintings</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\book.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b><a href='D:\\onlineshopping\\mobile.html '><img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td><img src='D:\\onlineshopping\\arw.jpg' align=left
hight=20 width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print(" </table> ");

String un,ccn,an,bn,id;
Date dt=new Date();
DateFormat
df=DateFormat.getDateInstance(DateFormat.DEFAULT);
String d=df.format(dt);
Connection con;
int i=0;
int k=0,a=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat6=con.prepareStatement("select
sum(subtotal) from itemtemp");
ResultSet rest6=pstat6.executeQuery();
rest6.next();
k=rest6.getInt(1);

pstat6=con.prepareStatement("select * from banktemp");


rest6=pstat6.executeQuery();

rest6.next();

an=rest6.getString(1);
ccn=rest6.getString(2);

pstat6=con.prepareStatement("select ammount from account where


AN=? and CCN=?");
pstat6.setString(1,an);
pstat6.setString(2,ccn);
rest6=pstat6.executeQuery();
rest6.next();
a=rest6.getInt(1);
}
catch(Exception e6)
{
System.out.println(e6);
}

if(a>=k)
{

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
Statement stat1=con.createStatement();
ResultSet rest=stat1.executeQuery("select * from genid");
rest.next();
i=rest.getInt(1);
i++;
PreparedStatement pstat=con.prepareStatement("update genid set
Orderno=?");
pstat.setInt(1,i);

pstat.executeUpdate();
}
catch(Exception e)
{
System.out.println(e);
}
pw.print(" <center> ");
pw.print("Your Order No is" + i);
pw.print("<br>");
pw.print("<br>");
pw.print(" when You not get your order you can claim on the behalf of
orderno");
pw.print("<br>");
pw.print("<font size=5 color=red> " + " THANK YOU FOR
PURCHASING " + "</font> ");

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
PreparedStatement pstat1=con.prepareStatement("select * from
usertemp");
ResultSet rest1=pstat1.executeQuery();
rest1.next();
id=rest1.getString(1);
un=rest1.getString(2);
pstat1=con.prepareStatement("select * from banktemp");
ResultSet rest2=pstat1.executeQuery();

rest2.next();

an=rest2.getString(1);
ccn=rest2.getString(2);

pstat1=con.prepareStatement("select * from itemtemp");


ResultSet rest3=pstat1.executeQuery();
while(rest3.next())
{
pstat1=con.prepareStatement("insert into purchase
values(?,?,?,?,?,?,?,?)");
pstat1.setInt(1,i);
pstat1.setString(2,id);
pstat1.setString(3,un);
pstat1.setString(4,d);

pstat1.setString(5,rest3.getString(1));
pstat1.setInt(6,Integer.parseInt(rest3.getString(2)));
pstat1.setInt(7,Integer.parseInt(rest3.getString(3)));
pstat1.setString(8,rest3.getString(5));

pstat1.executeUpdate();
}
PreparedStatement pstat2=con.prepareStatement("select
sum(subtotal) from itemtemp where ccn='credit'");
ResultSet rest4=pstat2.executeQuery();
rest4.next();
int t=rest4.getInt(1);

pstat2=con.prepareStatement("update account set


ammount=ammount-? where AN=?" );
pstat2.setInt(1,t);
pstat2.setString(2,an);
pstat2.executeUpdate();

Statement pstat3=con.createStatement();
/*
pstat3.setString(1,an);
pstat3.setString(2,ccn);*/

pstat3.executeUpdate("delete from banktemp");

Statement pstat4=con.createStatement();
pstat4.executeUpdate("delete from banktemp");

Statement pstat31=con.createStatement();
//pstat3=con.prepareStatement("delete from itemtemp");
pstat31.executeUpdate("delete from itemtemp");
/*pstat3.setString(1,rest3.getString(1));
pstat3.setInt(2,Integer.parseInt(rest3.getString(2)));
pstat3.setInt(3,Integer.parseInt(rest3.getString(3)));
pstat3.setInt(4,Integer.parseInt(rest3.getString(4)));
pstat3.executeUpdate();*/

//pstat3=con.prepareStatement();
//pstat3.setInt(1,t);
Statement pstat5=con.createStatement();
pstat5.executeUpdate("delete from totaltemp");
}
catch(Exception e1)
{
System.out.println(e1);

}
}
else
{
pw.print("you have no sufficiant ammount");
}

pw.print("</body>");
pw.print("</html>");
}}
Cash.java
import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class cash extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
Statement stat1=con.createStatement();
Statement stat2=con.createStatement();

ResultSet rest1=stat1.executeQuery("select * from usertemp");


ResultSet rest2=stat2.executeQuery("select * from itemtemp");
rest1.next();

pw.print(" <html> ");


pw.print(" <body> ");
pw.print("<form action=" + "http://localhost:8080/servlet/cashlast" +
">");
pw.print(" <p align=right>" + "<a
href='http://localhost:8080/servlet/front'> " + "<font color=#15317E>"
+ "<b> " + "HOME " + " </a> "
+ "&nbsp;&nbsp;" + "<a
href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E>" + "<b> " + " ABOUT US " + " </a> " +
"&nbsp;&nbsp" + "</font>" + "<font color=#15317E>" + "<b> " +
"<a href='http://localhost:8080/servlet/feedback'> " + "FEEDBACK"
+ "</a> " + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; " + " <font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");
pw.print(" <br> ");
pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <br> ");
pw.print(" <br> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");

pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/ece'> "


+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4 >Electronics &
&nbsp;"+"&nbsp;&nbsp;Computer</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Art & Paintings</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a
href='http://localhost:8080/servlet/moblie'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td> " + " <a href='http://localhost:8080/servlet/game'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print(" </table> ");
pw.print("<center>");
pw.print("<font color=red>" + rest1.getString(2) + "</font>" + "You
have purchased the following Items");
pw.print("</center>");
pw.print("<br>");

pw.print(" <center> ");


pw.print("<table border=4 bordercolor=orange cellpadding=8>" );
pw.print("<tr>");
pw.print("<td>");

pw.print("ItemName" + "</td>" + "<td>");


pw.print("Price" + "</td>" + "<td>");
pw.print("Quantity" + "</td>" + "<td>");
pw.print("SubTotal" + "</td>" + "</tr>");
while(rest2.next())
{
pw.print("<tr>");
pw.print("<td>");

pw.print(rest2.getString(1) + "</td>" + "<td>");


pw.print(Integer.parseInt(rest2.getString(2))+"</td>" + "<td>");
pw.print(Integer.parseInt(rest2.getString(3))+"</td>" + "<td>" ) ;
pw.print(Integer.parseInt(rest2.getString(4))+"</td>" + "</tr>" );

}
pw.print("</table>") ;
pw.print("</center>");

PreparedStatement pstat=con.prepareStatement("select sum(subtotal)


from itemtemp");
ResultSet rest=pstat.executeQuery();

rest.next();
int m=rest.getInt(1);
pw.print("<br> ");
pw.print("<br> ");
pw.print("<pre>");
pw.print(" Total=" + m);

pw.print("</pre>");
}
catch(Exception e)
{
}
pw.print(" <center> ");

pw.print("<br> ");
pw.print("<br> ");
pw.print("<br> ");
pw.print("<br> ");

pw.print("<input type=submit value=Confirm


style=color:white;background:green name=b1>");
pw.print("</form>");

pw.print("<form action=" + "http://localhost:8080/servlet/front" +


">");
pw.print("<input type=Submit value=AddtoCart
style=color:white;background:green name=b2>");

pw.print(" </center> ");


pw.print(" </form> ");
pw.print("</body> ");
pw.print("</html>");

}
Cashlast.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;
import java.util.Date;
import java.text.*;
public class cashlast extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res) throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

pw.print(" <html> ");


pw.print(" <body> ");
pw.print(" <p align=right>" + "<a
href='http://localhost:8080/servlet/front'> " + "<font color=#15317E>"
+ "<b> " + "HOME " + " </a> " + "&nbsp;&nbsp;"
+ "<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E>" + "<b> " + " ABOUT US " + " </a> " +
"&nbsp;&nbsp" + "</font>" + "<font color=#15317E>" + "<b> " +
"FEEDBACK" + "</p> ");
pw.print(" <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4> ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;" + " <font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");

pw.print(" <br> ");


pw.print(" <img src='d:\\onlineshopping\\cata.jpg' align=left> ");
pw.print(" <br> ");
pw.print(" </form> ");
pw.print(" <br> ");
pw.print(" <table border=0 bgcolor= #56A5EC align=left width=190>
");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/ece'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4 >Electronics &
&nbsp;"+"&nbsp;&nbsp;Computer</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/art'> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Art & Paintings</td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a href='http://localhost:8080/servlet/book'>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Books & Magazines</a></td> ");
pw.print(" </tr> ");
pw.print(" <tr> ");
pw.print(" <td><b> " + "<a
href='http://localhost:8080/servlet/moblie'> " + "<img
src='D:\\onlineshopping\\arw.jpg' align=left hight=20 width=20><font
color=white size=4>Mobile & Cameras<b></a></td> ");
pw.print(" </tr> ");
pw.print(" <td> " + "<a href='http://localhost:8080/servlet/game'> " +
"<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20><font color=white size=4>Games<b></a></td> ");
pw.print(" </tr> ");
pw.print(" </table> ");
String un,id;

Date dt=new Date();


DateFormat
df=DateFormat.getDateInstance(DateFormat.DEFAULT);
String d=df.format(dt);
Connection con;
int i=0;

try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
Statement stat1=con.createStatement();
ResultSet rest=stat1.executeQuery("select * from genid");
rest.next();
i=rest.getInt(1);
i++;
PreparedStatement pstat=con.prepareStatement("update genid set
Orderno=?");
pstat.setInt(1,i);

pstat.executeUpdate();
}
catch(Exception e)
{
System.out.println(e);
}
pw.print(" <center> ");
pw.print("<pre>");
pw.print("<b> " + "Your Order No is " + i);
pw.print("</pre>");
pw.print(" when You not get your order you can claim on the behalf of
orderno");
pw.print("<br>");
pw.print("<font size=5 color=red> " + " THANK YOU FOR
PURCHASING " + "</font> ");
int ttl=0;
String ccstr="";

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
Statement pstat1=con.createStatement();
PreparedStatement sts=con.prepareStatement("select sum(subtotal)
from itemtemp where ccn=?");
String sss="credit";
sts.setString(1,sss);
ResultSet rr=sts.executeQuery();
Statement sts1=con.createStatement();
ResultSet rr1=sts1.executeQuery("select CCN from banktemp");

while(rr.next())
{
pw.print(" KKKKK");
ttl=rr.getInt(1);
}

while(rr1.next())
{
pw.print("QQQ");
//pw.print(rr1.getString(1));
ccstr=rr1.getString(1);
PreparedStatement p1=con.prepareStatement("update Account set
Ammount=Ammount-? where CCN=?");
p1.setInt(1,ttl);
p1.setString(2,ccstr);
p1.executeUpdate();
pw.print("zzz");
}
ResultSet rest1=pstat1.executeQuery("select * from usertemp");
rest1.next();
id=rest1.getString(1);
un=rest1.getString(2);

Statement pstat8=con.createStatement();

ResultSet rest3=pstat8.executeQuery("select * from itemtemp");


pw.print("YYY");
while(rest3.next())
{
PreparedStatement pstat9=con.prepareStatement("insert into
purchase values(?,?,?,?,?,?,?,?)");
pstat9.setInt(1,i);
pstat9.setString(2,id);
pstat9.setString(3,un);
pstat9.setString(4,d);

pstat9.setString(5,rest3.getString(1));
pstat9.setInt(6,Integer.parseInt(rest3.getString(2)));
pstat9.setInt(7,Integer.parseInt(rest3.getString(3)));
pstat9.setString(8,rest3.getString(5));
//psta1.setString(9,rest3.getString(6));
pstat9.executeUpdate();
}
Statement pstat31=con.createStatement();

pstat31.executeUpdate("delete from itemtemp");


Statement pstat5=con.createStatement();
pstat5.executeUpdate("delete from totaltemp");

}
catch(Exception e1)
{
System.out.println(e1);
}

pw.print("</body>");
pw.print("</html>");
}}

Logout.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class logout extends GenericServlet


{
Connection con;
ResultSet rest1,rest2,rest3;
public void service(ServletRequest req,ServletResponse res)throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlineshoping");
Statement stat1;
stat1=con.createStatement();

stat1.executeUpdate("delete from usertemp");


}
catch(Exception e)
{
}

pw.print("<html>");
pw.print("<body>");
pw.print("<p align=right> " + " <a
href='http://localhost:8080/servlet/front> " + "<font
color=#15317E><b> " + " HOME</a> " + " &nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/aboutus'> " + " <font
color=#15317E><b> " + " ABOUT US</a> " + " &nbsp;&nbsp; " + "
<a href=> " + " <font color=#15317E><b> " + " FEEDBACK</a> " +
" </p> " + " <img src='d:\\onlineshopping\\india.jpg'> ");
pw.print(" <hr width=100% color=#3BB9FF size=4>");
pw.print("<img src='D:\\onlineshopping\\sidelogo.jpg' align=left> " +
" <img src='D:\\onlineshopping\\sidelogo.jpg' align=right>" + "
<br><br>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<font size=10 color=#347C17 ><b> " + " <i>ONLINE
SHOPPING</i></b> " + " </font>");
pw.print("<hr width=100% color=orange size=2 >");
pw.print("<font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/registration1'> " + " New user</a>
" + " &nbsp;&nbsp;" + " <font color=#15317E> " + " <a
href='http://localhost:8080/servlet/regis'><b> " + " Registered
user</a> " + " &nbsp;&nbsp; " + " <font color=#15317E> " + " <a
href='http://localhost:8080/servlet/accountinfo'><b> " + "
MyAccount</a>");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; ");
pw.print("
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; " + " <font color=#15317E><b> " + " <a
href='http://localhost:8080/servlet/logout'> " + " logout</a>");
pw.print("<hr width=100% color=#3BB9FF size=10 >");
pw.print("<marquee > " + " <font color=orange size=3><b> " + "
Welcome to Online Shopping " + " </font> " + " </marquee> " + "
<br><br><br><br>");

pw.print("</table>");
pw.print("<table border=2 bgcolor= white align=right cellpadding=2
cellspacing=2 >");
pw.print("<th> " + " <font size=6 color=#347C17><b> " +
"Electronics goods " + "</font> " + " </th>");
pw.print("<tr> " + "<td> " + " <a
href='d:\\onlineshopping\\ece.html'> " + "<img
src='D:\\onlineshopping\\tv1.jpg'> " + "</a> ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='d:\\onlineshopping\\mobile.html'> " + "<img
src='D:\\onlineshopping\\mb2.jpg'></a>");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='d:\\onlineshopping\\dvd.html'> " + "<img
src='D:\\onlineshopping\\dvd2.jpg'> " + " </a> ");
pw.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
pw.print("<a href='d:\\onlineshopping\\ece.html'> " + "<img
src='D:\\onlineshopping\\lp1.jpg'> " + "</a> " + "</td> " + "</tr>");
pw.print("<th> " + "<font size=6 color=#347C17><b> " + "Art &
Games</b> " + "</font>");
pw.print("<tr> " + "<td> " + "<a href='d:\\onlineshopping\\art.html'>
" + "<img src='D:\\onlineshopping\\art1.jpg'> " + "</a>");
pw.print("<a href='d:\\onlineshopping\\games.html'> " + "<img
src='D:\\onlineshopping\\gm1.jpg'> " + "</a>");
pw.print("<a href='d:\\onlineshopping\\art.html'> " + "<img
src='D:\\onlineshopping\\art2.jpg'> " + "</a>");
pw.print("<a href='d:\\onlineshopping\\games.html'> " + "<img
src='D:\\onlineshopping\\gm2.jpg'> " + "</a> " + "</td> " + "</tr> "
+ "</table>");
pw.print("<img src='d:\\onlineshopping\\cata.jpg' align=left> " +
"<br><br><br>");
pw.print(" <table border=0 bgcolor= #56A5EC align=left
width=190>");
pw.print("<tr>");

pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/ece'> "


+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4 > " + "Electronics & " + "
&nbsp;&nbsp;&nbsp; Computer " + "</a> " + "</td> " + "</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/art '> "
+ "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Art & Paintings " +
"</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/book '>
" + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Books & Magazines "
+ "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a href='http://localhost:8080/servlet/mobile
'> " + "<img src='D:\\onlineshopping\\arw.jpg' align=left hight=20
width=20> " + "<font color=white size=4> " + "Mobile & Cameras<b>
" + "</a> " + "</td>");
pw.print("</tr>");
pw.print("<tr>");
pw.print("<td> " + "<b><a
href='http://localhost:8080/servlet/game.html '> " + "<font
color=white size=4 > " + "<img src='D:\\onlineshopping\\arw.jpg'
align=left hight=20 width=20> " + "Games<b> " + "</a> " + "</td>");
pw.print("</tr> " + "</table> " +
"<br><br><br><br><br><br><br><br><br><br>");
pw.print("<img src='d:\\onlineshopping\\fr.jpg' align= left>");
pw.print("<br><br><br><br><br><br><br><br>");
pw.print("<img src='D:\\onlineshopping\\diwali.jpg' align=right >");

pw.print("</body>");
pw.print("</html>");

}
}
Aboutus.java

import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class aboutus extends GenericServlet


{
public void service(ServletRequest req,ServletResponse res)throws
IOException ,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

pw.print("<html>");
pw.print("<body><p align=right> " + "<a
href='http://localhost:8080/servlet/front'> " + "<font
color=#15317E><b> " + "HOME</a> " + "&nbsp;&nbsp;");
pw.print("<a href='http://localhost:8080/servlet/aboutus'> " + "<font
color=#15317E><b>" + "ABOUT US</a> " + "&nbsp;&nbsp; " + "<a
href='http://localhost:8080//servlet//feedback'> " + "<font
color=#15317E><b>" + "FEEDBACK</a> " + "</p>");
pw.print( "<img src='d:\\onlineshopping\\india.jpg'>");
pw.print("<hr width=100% color=#3BB9FF size=4>");
pw.print("<marquee bgcolor=#4E4848> " + " <font color=white font
size=4> " + " ABOUT US " + "</font> " + "</marquee>");
pw.print("<br> " + " <br>");
pw.print("<h1> " + "about us </h1>");

pw.print("<p> " + " <font size=3><b> ");


pw.print("India is a shopper's paradise. Shopping reminds us of
hopping from one shop to another and ");
pw.print("getting dead tired. But online shopping helps you to shop
from the comfort of your home, without");
pw.print(" bogged by tiredness of shop hopping and getting your
desired materials in affordable prices too.");
pw.print(" Want to buy the best? Then opt for the online shopping as
you will get a huge variety to choose");
pw.print("from. Just a click on the mouse helps you buy the product
of your choice. Bestindiansites.com ");
pw.print("compiles 10 websites on shopping to help you better." + "
<br>");

pw.print("India saw the light of online shopping through


eshoppingindia.com");
pw.print("Ebay shopping takes you on a tour of a different world
where you get a huge collection of");
pw.print("variety products to choose from. Have your puck and place
an online order. Get that product ");
pw.print("delivered to your home. Shopping has got a new, better
meaning with online facilities in today's");
pw.print(" age. " + "<br>");
pw.print("eshoppingindia brings for you the easiest and happy ways of
purchasing online. Know from this");
pw.print("site how online shopping can help you. You don't need to
run around shops anymore.");
pw.print("Just click on your mouse and get a wide collection of
products to choose from.");
pw.print("Have your pick. " + "<br>");

pw.print("Want to buy the best? Then opt for indiainfo.com. Visit this
online shopping site of and");
pw.print(" choose from the wide collection of apparels, books,
confectioneries, electronics, flowers,");
pw.print(" movies, toys and lots more. This online shopping store
brings for you the best and branded");
pw.print(" products. Enjoy buying online." + "</p>");

pw.print("<font color=red size=5> ");


pw.print("<h1> " + "FROGET PASSWORD " + " </h1>");
pw.print(" if you forget your password contact to us at aur address
and you can contact also on this no-0099977779");
pw.print("</body>");
pw.print("</html>");
}
}
Feedback.java
import java.io.*;
import javax.servlet.*;
import java.sql.*;

public class feedback extends GenericServlet


{
Connection con;
ResultSet rest1,rest2,rest3;
public void service(ServletRequest req,ServletResponse res)throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();

pw.print("<html>");
pw.print("<body>");
pw.print("<br><br>");
pw.print("<table bgcolor=#3399FF>");
pw.print("<tr> " + " <td>");

pw.print("</td> " + " </tr> " + " </table> " + " <br><br>");
pw.print("<table cellSpacing=0 cellPadding=0 width=100%
border=.5>");
pw.print("<tr>");
pw.print("<td> " + " <br>");
pw.print("<pre><font size=4>" + " <b> Feedback Form </b> " + "
</font> " + " </pre><pre> ");
pw.print("<form action='http://localhost:8080/servlet/feedback2'>");
pw.print(" <strong>Name</strong> <input Type=Text name=t1
size=15> " + "<br><br>");
pw.print(" <strong>Email id</strong> " + " <input Type=Text
name=t2 size=15> " + " <br><br>");
pw.print(" <strong>Enter Your Comments:<strong> " + " <br>");
pw.print(" <textarea wrap=virtual name=t3 rows=10
cols=40 maxlength=100> " + " </textarea> " + " <br>");

pw.print(" <input type=submit value=Submit> " + "


<br><br><br>");
pw.print("</pre>" + " </td> " + " </tr>");
pw.print("</TABLE>" + "<br><br><br><br><br><br>");
pw.print("<hr color= ' #CFECEC ' size=3 width=80%>");

pw.print("</body>");
pw.print("</html>");
}
}
Feedback2.java
import java.io.*;
import javax.servlet.*;
import java.sql.*;
import java.util.Date;
import java.text.*;
public class feedback2 extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res)throws
IOException,ServletException
{
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
try
{

Date dt=new Date();


DateFormat
df=DateFormat.getDateInstance(DateFormat.DEFAULT);
String w=df.format(dt);

Date t=new Date();


DateFormat
tf=DateFormat.getTimeInstance(DateFormat.DEFAULT);
String r=tf.format(t);

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:onlinebanking");
PreparedStatement pstat=con.prepareStatement("insert into feedback
values(?,?,?,?,?)");
pstat.setString(1,req.getParameter("t2"));
pstat.setString(2,req.getParameter("t1"));
pstat.setString(3,req.getParameter("t3"));
pstat.setString(4,w);
pstat.setString(5,r);
pstat.executeUpdate();
pw.print("<font size=5 font color=blue><b>ThankYou</b></font>");
}
catch(Exception e){System.out.println(e+ "DCFG");}
}
}
Tables

newuser

FirstName LastName Emailaddress Contactno Homeaddress City userID Password


jyoti mehta mehta123@yahoo.com 12345 ewwe wefwe jm fighter

neha arora neha123@gmail.com 543545 dsfdvds, dfhwjfh delhi nanu no


jdkljf kfdl

pratibha pachar 45gh4 34567 g4rg g45g pratibha plane

rittu arora rittu.arora@gmail.com 123456789 parshuram chowk sirsa ritima atma

softy mau billi.com 100 govt polly sirsa softy mycat

usertemp

userID FirstName
jm jyoti

itemtemp

ItemName Price Quantity subtotal ccn

ArtPanelHanger1 299 1 299 credit

IdeaOfJustice 559 2 1118 credit

IdeaOfJustice 559 3 1677 credit

CrossGanesha 2500 2 5000 cash


banktemp

AN CCN

11111 123

Account
AN CCN Accountholder Ammount
11111 123 pratibha 39153
11112 234 jyoti 3207780

11113 345 rashmi 18231


11114 456 palak 17231

11115 567 neha -105903


11116 678 ritu -95906

genid
Orderno
5
purchase
Orderno userID FirstName Date ItemName Price Quantity ccn
12 pratibha pratibha Oct 18, 2009 Krishna 262 1 credit
12 pratibha pratibha Oct 18, 2009 CrossGanesha 2500 1 cash
15 pratibha pratibha Oct 18, 2009 ArtMirror 1699 1 credit
16 pratibha pratibha Oct 19, 2009 ArtPanelHanger2 249 1 credit
16 pratibha pratibha Oct 19, 2009 LostSymbol 524 1 cash
21 pratibha pratibha Oct 20, 2009 ArtPanelHanger2 249 1 cash
21 pratibha pratibha Oct 20, 2009 ArtPanelHanger1 299 1 cash
23 pratibha pratibha Oct 20, 2009 ArtPanelHanger2 249 1 cash
31 pratibha pratibha Oct 20, 2009 ArtPanelHanger1 299 1 credit
31 pratibha pratibha Oct 20, 2009 BrassArtPanel 2999 1 cash
32 pratibha pratibha Oct 20, 2009 ArtPanelHanger1 299 1 credit
32 pratibha pratibha Oct 20, 2009 ArtPanelHanger2 249 1 cash
33 pratibha pratibha Oct 20, 2009 ArtPanelHanger1 299 1 credit
33 pratibha pratibha Oct 20, 2009 ArtPanelHanger2 249 1 credit
12 pratibha pratibha Oct 18, 2009 BrocadeJwelleryPouch 150 2 credit

Software and Hardware Requirement

Recommended Hardware Requirement:-

 P4 Processor
 2 GB RAM
 250 GB Harddisk

Software Requirement:-

 Operating System:-Window XP,Vista


 JDK1.3
 Jsdk 2.0
 JDBC ODBC Driver
 DBMS like MS-Access
 Brouser like Internet Explorer

What are Java Servlets?


Servlets are snippets of Java programs which run inside a Servlet
Container. A Servlet Container is much like a Web Server which
handles user requests and generates responses. Servlet Container is
different from a Web Server because it can not only serve requests
for static content like HTML page, GIF images, etc., it can also
contain Java Servlets and JSP pages to generate dynamic response.
Servlet Container is responsible for loading and maintaining the
lifecycle of the a Java Servlet. Servlet Container can be used
standalone or more often used in conjunction with a Web server.
Example of a Servlet Container is Tomcat and that of Web Server is
Apache.

Servlets are actually simple Java classes which must implement the
javax.servlet.Servlet interface. This interface contains a total of
five methods. Most of the time you don't need to implement this
interface. Why? Because javax.servlet package already provides
two classes which implement this interface i.e. GenericServlet and
HttpServlet. So all you need to do is to extend one of these
classes and override the method(s) you need for your Servlet.
GenericServlet is a very simple class which only implements the
javax.servlet.Servlet interface and provides only basic
functionality. On the other hand, HttpServlet is a more useful class
which provides methods to work with the HTTP protocol. So if your
Servlet works with HTTP protocol (in most cases this will be the
case) then you should extend javax.servlet.http.HttpServlet
class to build Servlets .

Servlets once initialized are kept in memory. So every request


which the Servlet Container receives, is delegated to the in-memory
Java Servlet which then generates the response. This 'kept in
memory' feature makes Java Servlets, a fast and efficient method of
building Web Applications.

Lifecycle of a servlet
The servlet lifecycle consists of the following steps:

1. The servlet class is loaded by the container during start-up.


2. The container calls the init() method. This method initializes the servlet and
must be called before the servlet can service any requests. In the entire life of a
servlet, the init() method is called only once.
3. After initialization, the servlet can service client requests. Each request is
serviced in its own separate thread. The container calls the service()
method of the servlet for every request. The service() method determines
the kind of request being made and dispatches it to an appropriate method to
handle the request. The developer of the servlet must provide an
implementation for these methods. If a request for a method that is not
implemented by the servlet is made, the method of the parent class is called,
typically resulting in an error being returned to the requester.
4. Finally, the container calls the destroy() method that takes the servlet out of
service. The destroy() method like init() is called only once in the
lifecycle of a servlet.

ServletConfig and ServletContext


There is only one ServletContext in every application. This object
can be used by all the servlets to obtain application level
information or container details. Every servlet, on the other hand,
gets its own ServletConfig object. This object provides initialization
parameters for a servlet. A developer can obtain the reference to
ServletContext using the ServletConfig object.

The "servletcontext" object was created by the container at the time


of servlet initialization and destroyed just before the servlet
deinstantion i.e., the scope of the sevletcontext object is the scope
of the web application..

There will be only one serveltcontext object for the entire web
application. servletcontext object was created by the container if it
is the first request form the client other wise it will create the
reference of the existed object.

Servlet containers
A servlet container is a specialized web server that supports servlet execution. It
combines the basic functionality of a web server with certain Java/servlet specific
optimizations and extensions – such as an integrated Java runtime environment, and
the ability to automatically translate specific URLs into servlet requests. Servlet
containers are also referred to as web containers or web engines.
RMI
Remote Method Invocation (RMI) facilitates object function calls between Java
Virtual Machines (JVMs). JVMs can be located on separate computers - yet one JVM
can invoke methods belonging to an object stored in another JVM. Methods can even
pass objects that a foreign virtual machine has never encountered before, allowing
dynamic loading of new classes as required. This is a powerful feature!

Consider the follow scenario :

 Developer A writes a service that performs some useful function. He regularly


updates this service, adding new features and improving existing ones.
 Developer B wishes to use the service provided by Developer A. However, it's
inconvenient for A to supply B with an update every time.

Java RMI provides a very easy solution! Since RMI can dynamically load new classes, Developer B
can let RMI handle updates automatically for him. Developer A places the new classes in a web
directory, where RMI can fetch the new updates as they are required.

Figure 1 - Connections made when client uses RMI

Figure 1 shows the connections made by the client when using RMI. Firstly, the client must contact
an RMI registry, and request the name of the service. Developer B won't know the exact location of
the RMI service, but he knows enough to contact Developer A's registry. This will point him in the
direction of the service he wants to call..

Developer A's service changes regularly, so Developer B doesn't have a copy of the
class. Not to worry, because the client automatically fetches the new subclass from a
webserver where the two developers share classes. The new class is loaded into
memory, and the client is ready to use the new class. This happens transparently for
Developer B - no extra code need to be written to fetch the class.

• Remote Method Invocation


NetBank example

JDBC Architecture
Java applications cannot directly communicate with a database to submit data and
retrieve the results of queries. This is because a database can interpret only SQL
statements and not java language statements. For this reason,you need a mechanism to
translate java statements into SQL statements.
The JDBC architecture can be classified into two layers:
1) JDBC architecture layer
2) JDBC driver layer

JDBC Drivers:-
When you develop JDBC applications, you need to use JDBC drivers to convert
queries into a form that a particular database can interpret. The JDBC Driver also
retrieves the result of SQL statements and converts the result into equivalent JDBC
API class objects that the java application uses. As the JDBC driver only take care of
interactions with the database, any change made to the database does not affect the
application. JDBC supports 4 types of drivers they are:-
1) JDBC-ODBC Bridge driver
2) Native API Partly java driver
3) JDBC-Net Pure java driver
4) Native Protocol Pure java driver

Loadind a Driver:-

The first step to develop a JDBC application is to load and register the required
driver using the driver manager. You can load and register a driver:
Programmaticaly :-
1) Using a forname() method
2) Using a registeredDriver() method

Manually:-
1) By setting system property

DATAGRAMS
Datagrams are bundles of information passed between machines. They are
somewhatlike a hard throw from a well-trained but blindfolded catche to the third
baseman. Once the datagram has been released to its intended target, there is no
assurance that it will arrive or even that someone will be there to catch it. Likewise,
when the datagram is received, there is no assurance that it has’t been damaged in
tranist or that whoever sent it is still there to receive a response.
Java implements datagrams on top of the UDP protocol by using two classes.The
DatagramPacket object is the data container,while the DatagramSocket is the
mechanism ued to send or receive the DatagramPavkets.

Das könnte Ihnen auch gefallen