Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Shopping
try
{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Con=DriverManager.getConnection("jdbc
:odbc:batch",
"batch10","batch10");
S=con.createStatement ();
stmt=con.createStatement ();
rs=s.executeQuery("select * from custregistration");
a=sessionid.length ();
sessionid=sessionid.substring
(1,a);
break;
}
}
54
if(sessionid==null)
sessionid=user_id;
if (user_id.equals("smartshoppee")
&&password. equals(str))
{ flag=3; break; }
if(user_id.equals(str1))
{f=1;
if(password. equals(str))
{ }
else
{
out.println("<font color
=green size=8>Invalid password try again</font><br><div align
=right>");
out.println("<a
href=c:/javawebserver2.0/public_html/lgon.html>login</a></div>");
flag=10;
break;
}
}
if(f==1&&!password.equals(str))
{
out.println("<font color
=blue size=8>Invalid User Id try again</font><br><div align =right>");
out.println("<a
href=c:/javawebserver2.0/public_html/lgon.html>login</a></div>");
break;
}else if (flag==0) {flag=5;}
55
if(user_id.equals(str1)&&password.equals(str))
{
row=stmt.executeUpdate ("insert into login
values('"+user_id+"','"+password+"')");
con.commit ();
}
After login the customer is provided with the list of items like
FLOWERS, GIFTARTICLES, ELECTRONICS, JEWELLERY etc. After
clicking the particular item the reference to the next servlet is as
follows:
56
out.println("</div>");
//the reference for the signout is follows:
<BODY bgColor="#FFFF99">
<img border="0" src="untitled.gif" width="487"
height="105"><font color="#FF00FF"><marquee><strong><i>shop for
online shoppers</i></strong></marquee>
</font>
<hr align="left" color="#FF0000">
<table border="0" size="100%"
width="100%"><tr><th width="100%" align="left" colspan="2">
<th width="50%" align="left">
<strong><i><font size="2"
color="#000000">In our shop we provide the following:
(Flowers, Electronics,Books,Jewellery Gift
Articles etc.)</font></i></strong>
</table>
<formmethod="get"
action="http://localhost:8080/servlet/regs" onSubmit="">
<table border="0" width="100%">
<tr>
58
The parameters given by the new customer in the registration form are
received by the next servlet as follows:
String name=req.getParameter("name");
String userid=req.getParameter("userid");
String password=req.getParameter("password");
String address=req.getParameter("address");
String city=req.getParameter("city");
String state=req.getParameter("state");
String pincode=req.getParameter("pincode");
String email=req.getParameter("email");
59