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

📄 checkout2ejsp.java

📁 JSP+SQL应用开发网上书店系统,采用BMP模式开发
💻 JAVA
字号:
import java.sql.*;
import java.util.*;
import hell.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class checkout2ejsp extends HttpJspBase {


    static {
    }
    public checkout2ejsp( ) {
    }

    private static boolean _jspx_inited = false;

    public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
    }

    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;
        String  _value = null;
        try {

            if (_jspx_inited == false) {
                synchronized (this) {
                    if (_jspx_inited == false) {
                        _jspx_init();
                        _jspx_inited = true;
                    }
                }
            }
            _jspxFactory = JspFactory.getDefaultFactory();
            response.setContentType("text/html; charset=GBK");
            pageContext = _jspxFactory.getPageContext(this, request, response,
            			"", true, 8192, true);

            application = pageContext.getServletContext();
            config = pageContext.getServletConfig();
            session = pageContext.getSession();
            out = pageContext.getOut();

            // HTML // begin [file="/checkout.jsp";from=(0,48);to=(1,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/checkout.jsp";from=(1,50);to=(2,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/checkout.jsp";from=(2,26);to=(44,0)]
                out.write("\r\n<html>\r\n<h1>\r\n<div align=\"center\"></div>\r\n<style type=\"text/css\">\r\n<!--\r\nbody {\r\n\tmargin-top: 0px;\r\n}\r\n.style5 {font-family: monospace, sans-serif, \"·\\u00BD\\u00D5\\u00FD\\u00CA\\u00E6\\u00CC\\u00E5\", \"·\\u00BD\\u00D5\\u00FD\\u00D2\\u00A6\\u00CC\\u00E5\"; font-size: 24px; }\r\na:link {\r\n\ttext-decoration: none;\r\n}\r\na:visited {\r\n\ttext-decoration: none;\r\n}\r\na:hover {\r\n\ttext-decoration: underline;\r\n}\r\na:active {\r\n\ttext-decoration: none;\r\n}\r\n.style6 {font-family: monospace, sans-serif, \"????\", \"????\"}\r\n-->\r\n    </style>\r\n\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>\r\n<body bgcolor=\"white\" onLoad=\"MM_callJS('Today.getday()')\">\r\n<h1><b><center>\r\n</center></b></h1>\r\n<hr>\r\n<div align=\"center\"></div>\r\n<table width=\"936\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#CCCCCC\">\r\n<tr>\r\n<td width=\"131\" class=\"style5\"><div align=\"center\"><a href=\"index.jsp\" class=\"style5\"><strong>用户登陆</strong></a></div></td>\r\n<td width=\"178\" class=\"style5\"><div align=\"center\"><a href=\"booklist.jsp\" class=\"style5\"><strong>在线购物</strong></a></div></td>\r\n<td width=\"239\" class=\"style5\"><div align=\"center\"><a href=\"cart.jsp\" class=\"style5\"><strong>我的购物车</strong></a></div>\r\n<div align=\"center\"></div></td>\r\n<td width=\"378\" align=\"right\" class=\"style5\"><div align=\"center\"><a href=\"list.jsp\" class=\"style5\"><strong>我的订单</strong></a></div></td>\r\n</tr>\r\n</table>\r\n<body>\r\n");

            // end
            // begin [file="/checkout.jsp";from=(44,2);to=(47,0)]
                
                Vector buylist=(Vector)session.getValue("cart");
                if(buylist==null||buylist.size()<1){
            // end
            // HTML // begin [file="/checkout.jsp";from=(47,2);to=(48,0)]
                out.write("\r\n");

            // end
            // begin [file="/checkout.jsp";from=(48,0);to=(48,44)]
                if (true) {
                    out.clear();
                    String _jspx_qfStr = "";
                    pageContext.forward("index.jsp" +  _jspx_qfStr);
                    return;
                }
            // end
            // HTML // begin [file="/checkout.jsp";from=(48,44);to=(49,0)]
                out.write("\r\n");

            // end
            // begin [file="/checkout.jsp";from=(49,2);to=(72,0)]
                }
                String userId=(String)session.getValue("userId");
                float pricenum=0;
                for(int i=0;i<buylist.size();i++){
                  Book book=(Book)buylist.elementAt(i);
                  pricenum=pricenum+book.getBuynum()*book.getBookMoney();
                }
                for(int j=0;j<buylist.size();j++){
                Book book=(Book)buylist.elementAt(j);
                DBSQLManager dbsm=new DBSQLManager();
                String sql="INSERT INTO ListTable(BookId,BookName,BookAuthor,BookDetail,BookMoney,userId) VALUES('"+book.getBookId()+"','"+book.getBookName()+"','"+book.getBookAuthor()+"','"+book.getBookDetail()+"','"+book.getBookMoney()+"','"+userId+"')";
                 dbsm.setSqlStr(sql);
                 dbsm.executeUpdate();
                 //dbsm.close();
                }
                //DBSQLManager dbsm1=new DBSQLManager();
                //String sql1="SELECT TableId FROM BookList WHERE userId='"+userId+"'";
                // dbsm1.setSqlStr(sql1);
                // dbsm1.executeQuery();
                // ResultSet rs=dbsm1.getRs();
                // rs1.next();
                // String tableId=rs.getString("TableId");
                // dbsm1.close();
            // end
            // HTML // begin [file="/checkout.jsp";from=(72,2);to=(79,7)]
                out.write("\r\n<div align=\"center\"><img src=\"bb5_1.jpg\"></div>\r\n</h1>\r\n<td height=\"22\" class=\"style11\"><div align=\"center\"><a href=\"booklist.jsp\">\r\nBack</a></div>\r\n</td>\r\n</body>\r\n</html>");

            // end

        } catch (Throwable t) {
            if (out != null && out.getBufferSize() != 0)
                out.clearBuffer();
            if (pageContext != null) pageContext.handlePageException(t);
        } finally {
            if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
        }
    }
}

⌨️ 快捷键说明

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