⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 purchase.jsp

📁 Easy_Buy是一个在线销售系统
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="pool" scope="application" class="PoolBean"/>
<jsp:useBean id="list" scope="session" class="ProductListBean"/>
<jsp:setProperty name="list" property="*"/>
<% 
	Product prod=list.getProduct();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<center>
<% 
if(session.getValue("username")==null)
{
	response.sendRedirect("shoppingError.jsp");
}
else
{
	String user=(String)session.getValue("username");
	int p_id=prod.productID;
		
	Connection conn=pool.getConnection();
	Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);  
	String sql1="insert into cart(username,productID) values ('"+user+"',"+p_id+")"; 
	stmt.executeUpdate(sql1);
	stmt.close();
	pool.releaseConnection(conn);
	response.sendRedirect("purchaseOK.jsp");
}
%>
</center>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -