jsp网上书店网页设计 第4页
session.setAttribute("goods",pa); //将nm对象加入session中,并指定关键字为name
%>
<p>这里是结账处。
<% String cus=(String)session.getAttribute("custom");
String nam=(String)session.getAttribute("username");
String goo=(String)session.getAttribute("goods");
nam=getString(nam);
goo=getString(goo);
%>
<br>
<p><%=cus%>的姓名是:::<%=nam%>
<p>您选购的商品是:"<%=goo%>"
<p>
<%
String id="";
Statement sql=null;
ResultSet rs=null;
try {
Connection con;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:shop","root","123456");
sql=con.createStatement();
/*
String query="SELECT username FROM users";
rs = sql.executeQuery(query);
username=rs.getString(2);
if(username.value == "username") out.print("该用户名已经存在!");
else */
//{
String query="SELECT id FROM orderform";
rs = sql.executeQuery(query);
while (rs.next())
{ id=rs.getString(1);
}
if (id.equals("")) id="1";
else{
int tmp=Integer.parseInt(id);
tmp++;
Integer t=new Integer(tmp);
id=t.toString();
}
out.println("恭喜您!这本站的第"+id+"次商品交易!");
// }
String insert=
"INSERT INTO orderform(logname,book_name) VALUES"+"('"+nam+"','"+goo+"')";
sql.executeUpdate(insert); //执行添加操作:
}
catch(SQLException event)
{ }
四.
public String codeString(String s)
{ String str=s;
try{byte b[]=str.getBytes("ISO-8859-1");
str=new String(b);
return str;
}
catch(Exception e)
{ return str;
}
}
%>
<%
String id="",username="",realname="",password="",email="",phone="",address="";
username=request.getParameter("username");
username=codeString(username);{
realname=request.getParameter("realname");
realname=codeString(realname);
password=request.getParameter("password");
password=codeString(password);
email=request.getParameter("email");
email=codeString(email);
phone=request.getParameter("phone");
phone=codeString(phone);
address=request.getParameter("address");
address=codeString(address);
//Connection con=null;
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页
jsp网上书店网页设计 第4页下载如图片无法显示或论文不完整,请联系qq752018766