-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcart1.jsp
More file actions
51 lines (41 loc) · 1.16 KB
/
cart1.jsp
File metadata and controls
51 lines (41 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<%@page import="java.sql.*"%>
<%
String r,user,p1,d1,d2,d3,d4,d5,id;
r=request.getParameter("prodId");
user=request.getParameter("un");
p1=request.getParameter("pwd");
Connection con;
Statement stmt;
try
{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/system_station","root","9353");
stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from product where prod_id='"+r+"' ");
while(rs.next()){
id=r;
d1=rs.getString(2);
d2=rs.getString(3);
d3=rs.getString(4);
d4=rs.getString(5);
d5=rs.getString(7);
try
{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/system_station","root","9353");
stmt=con.createStatement();
int k=stmt.executeUpdate("insert into cart values('"+id+"','"+d1+"','"+d2+"','"+d3+"','"+d4+"','"+d5+"')");
}
catch(Exception e)
{
out.println(e);
}
}
}
catch(Exception e)
{
out.println(e);
}
%>
<%-- <jsp:forward page="Home.jsp?username=<%= user %>&password=<%= p1 %>"/> --%>
<jsp:forward page="cart.jsp"/>