📄 shoperlist_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;
import java.sql.*;
import com.mybusiness.web.ware.wareclass;
import com.mybusiness.web.ware.ware;
import com.mybusiness.web.waremn;
import com.mybusiness.web.ware.indentlist;
public final class shoperlist_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
com.mybusiness.web.waremn book_list = null;
synchronized (_jspx_page_context) {
book_list = (com.mybusiness.web.waremn) _jspx_page_context.getAttribute("book_list", PageContext.PAGE_SCOPE);
if (book_list == null){
book_list = new com.mybusiness.web.waremn();
_jspx_page_context.setAttribute("book_list", book_list, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
com.mybusiness.web.wareclasslist classlist = null;
synchronized (_jspx_page_context) {
classlist = (com.mybusiness.web.wareclasslist) _jspx_page_context.getAttribute("classlist", PageContext.PAGE_SCOPE);
if (classlist == null){
classlist = new com.mybusiness.web.wareclasslist();
_jspx_page_context.setAttribute("classlist", classlist, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
com.mybusiness.web.purchase shop = null;
synchronized (_jspx_page_context) {
shop = (com.mybusiness.web.purchase) _jspx_page_context.getAttribute("shop", PageContext.PAGE_SCOPE);
if (shop == null){
shop = new com.mybusiness.web.purchase();
_jspx_page_context.setAttribute("shop", shop, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
com.mybusiness.web.DataBase data = null;
synchronized (_jspx_page_context) {
data = (com.mybusiness.web.DataBase) _jspx_page_context.getAttribute("data", PageContext.PAGE_SCOPE);
if (data == null){
data = new com.mybusiness.web.DataBase();
_jspx_page_context.setAttribute("data", data, PageContext.PAGE_SCOPE);
}
}
out.write("\r\n");
out.write("\r\n");
String userid = (String) session.getAttribute("userid");
if ( userid == null )
userid = "";
String modi = request.getParameter("modi");
String del = request.getParameter("del");
String payoutCar = request.getParameter("payout");
String clearCar = request.getParameter("clear");
String mesg = "";
if (modi!=null && !modi.equals("")) {
if ( !shop.modiShoper(request) ){
if (shop.getIsEmpty())
mesg = "你要的修改购买的商品数量不足你的购买数量!";
else
mesg = "修改购买数量出错!";
} else {
mesg = "修改成功";
}
}else if ( del != null && !del.equals("") ) {
if ( !shop.delShoper(request) ) {
mesg = "删除清单中的商品时出错!" ;
}
}else if (payoutCar != null && !payoutCar.equals("") ) {
if (shop.payout(request) ) {
long USERID=0;
USERID = Long.parseLong(userid);
String IndentNo = "";
String sqlStr="";
Vector purchaselist;
Statement stmt = null;
ResultSet rs = null;
stmt= data.getStatement();
rs= data.getResultSet();
purchaselist = (Vector)session.getAttribute("shopcar");
String Content = request.getParameter("content");
if (Content==null)
{
Content="";
}
Content = new String(Content.getBytes("ISO-8859-1"),"GBK");
String IP = request.getRemoteAddr();
String TotalPrice = request.getParameter("totalprice");
sqlStr = "select max(id) from My_indent";
rs = stmt.executeQuery(sqlStr);
if (rs.next())
{
IndentNo = "HYD" + USERID + "" + rs.getString(1);
} else {
IndentNo = "HYD" + USERID + "0";
}
rs.close();
sqlStr = "insert into My_indent (IndentNo,UserId,SubmitTime,TotalPrice,content,IPAddress,IsPayoff,IsSales) values ('";
sqlStr = sqlStr + IndentNo + "','";
sqlStr = sqlStr + USERID + "',now(),'";
sqlStr = sqlStr + TotalPrice + "','";
sqlStr = sqlStr + Content + "','";
sqlStr = sqlStr + IP + "',1,1)";
stmt.execute(sqlStr);
sqlStr= "select max(id) from My_indent where UserId = " + USERID;
rs = stmt.executeQuery(sqlStr);
long indentid = 0;
while (rs.next())
{
indentid = rs.getLong(1);
}
rs.close();
for (int i=0; i<purchaselist.size() ;i++ )
{
indentlist iList = (indentlist) purchaselist.elementAt(i);
sqlStr = "insert into My_indentlist (IndentNo,BookNo,Amount) values (";
sqlStr = sqlStr + indentid + ",'";
sqlStr = sqlStr + iList.getBookNo() + "','";
sqlStr = sqlStr + iList.getAmount() + "')";
stmt.execute(sqlStr);
sqlStr = "update My_book set leav_number=leav_number - " + iList.getAmount() + " where id = " + iList.getBookNo();
stmt.execute(sqlStr);
}
mesg = "你的购物车中的物品已提交给本店,你的订单号为 "+ IndentNo + "<br>请及时付款,以便我们发货!";
session.removeAttribute("shopcar");
} else {
if(!shop.getIsLogin())
mesg = "你还没有登录,请先<a href=login.jsp>登录</a>后再提交";
else
mesg = "对不起,提交出错,请稍后重试";
}
} else if (clearCar != null && ! clearCar.equals("") ) {
session.removeAttribute("shopcar");
mesg = "购物车中的物品清单已清空";
}
out.write("\r\n");
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<title>商场翱游购物系统--我的购物车</title>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -