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

📄 cart2ejsp.java

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


public class cart2ejsp extends HttpJspBase {


    static {
    }
    public cart2ejsp( ) {
    }

    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="/cart.jsp";from=(0,48);to=(1,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/cart.jsp";from=(1,61);to=(56,0)]
                out.write("\r\n\r\n<html>\r\n<head>\r\n<title>BookStore Online</title>\r\n<style type=\"text/css\">\r\n<!--\r\nbody {\r\n\tmargin-top: 0px;\r\n}\r\n.style2 {font-family: monospace, sans-serif, \"·\\u00BD\\u00D5\\u00FD\\u00CA\\u00E6\\u00CC\\u00E5\", \"·\\u00BD\\u00D5\\u00FD\\u00D2\\u00A6\\u00CC\\u00E5\"}\r\n.style4 {\r\n\tfont-size: 24px;\r\n\tfont-weight: bold;\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: 18px; }\r\na:link {\r\n\ttext-decoration: none;\r\n\tcolor: #FF6600;\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, \"·\\u00BD\\u00D5\\u00FD\\u00CA\\u00E6\\u00CC\\u00E5\", \"·\\u00BD\\u00D5\\u00FD\\u00D2\\u00A6\\u00CC\\u00E5\"; font-size: 18px; font-weight: bold; }\r\n-->\r\n</style>\r\n</head>\r\n<body bgcolor=\"#ffffff\">\r\n<hr>\r\n<h1>\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<div align=\"center\"></div>\r\n<table width=\"800\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#CCCCCC\">\r\n<tr>\r\n<td width=\"500\"><div align=\"center\">\r\n<a class=\"titile\">我的购物车</a></div>\r\n<table width=\"100%\" height=\"48\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\" >\r\n</tr>\r\n</table>\r\n\r\n");

            // end
            // begin [file="/cart.jsp";from=(56,2);to=(60,0)]
                
                Vector buylist=(Vector)session.getValue("cart");
                if(buylist!=null&&(buylist.size()>0)){
                   float pricenum=0;
            // end
            // HTML // begin [file="/cart.jsp";from=(60,2);to=(68,0)]
                out.write("\r\n\r\n<form name=\"form1\" method=\"post\" action=\"checkout.jsp\">\r\n<table width=\"700\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tr>\r\n<td width=\"430\" height=\"22\"><div align=\"center\">书名</div></td>\r\n<td width=\"248\" ><div align=\"center\">单价</div></td>\r\n<td width=\"148\" ><div align=\"center\">数量</div></td>\r\n");

            // end
            // begin [file="/cart.jsp";from=(68,2);to=(68,53)]
                //<td width="48" ><div align="center">操作</div></td>
            // end
            // HTML // begin [file="/cart.jsp";from=(68,55);to=(70,0)]
                out.write("\r\n</tr>\r\n");

            // end
            // begin [file="/cart.jsp";from=(70,2);to=(73,0)]
                 for  (int i = 0; i <buylist.size(); i++){
                    Book book=(Book)buylist.elementAt(i);
                    pricenum=pricenum+book.getBuynum()*book.getBookMoney();
            // end
            // HTML // begin [file="/cart.jsp";from=(73,2);to=(75,37)]
                out.write("\r\n<tr>\r\n            <td><span class=\"style6\">");

            // end
            // begin [file="/cart.jsp";from=(75,40);to=(75,58)]
                out.print(book.getBookName());
            // end
            // HTML // begin [file="/cart.jsp";from=(75,60);to=(76,37)]
                out.write("&nbsp;</span></td>\r\n            <td><span class=\"style6\">");

            // end
            // begin [file="/cart.jsp";from=(76,40);to=(76,59)]
                out.print(book.getBookMoney());
            // end
            // HTML // begin [file="/cart.jsp";from=(76,61);to=(77,37)]
                out.write("&nbsp;</span></td>\r\n            <td><span class=\"style6\">");

            // end
            // begin [file="/cart.jsp";from=(77,40);to=(77,56)]
                out.print(book.getBuynum());
            // end
            // HTML // begin [file="/cart.jsp";from=(77,58);to=(78,12)]
                out.write("&nbsp;</span></td>\r\n            ");

            // end
            // begin [file="/cart.jsp";from=(78,14);to=(78,98)]
                //<td><div align="center"><input name="remove" type="submit"  value="删除"></div></td>
            // end
            // HTML // begin [file="/cart.jsp";from=(78,100);to=(80,0)]
                out.write("\r\n</tr>\r\n");

            // end
            // begin [file="/cart.jsp";from=(80,2);to=(92,0)]
                
                //try{
                  // int bookId=Integer.parseInt(request.getParameter("bookId"));
                  // String sql="DELECT FROM ListTable WHERE bookId=?";
                  // PreparedStatement prepstmt=null;
                  // prepstmt=con.prepareStatement(sql);
                  // prepstmt.executeUpdate();
                   //response.sendRedirect("cart.jsp");
                   //}catch(Exception e){
                    // out.println("错误信息:"+e.getMessage());
                   // }
                //}
            // end
            // HTML // begin [file="/cart.jsp";from=(92,2);to=(96,25)]
                out.write("\r\n<tr>\r\n<td height=\"45\" colspan=\"3\"><div align=\"center\"></div>\r\n<div align=\"center\"></div>\r\n<div align=\"center\">总计价格:");

            // end
            // begin [file="/cart.jsp";from=(96,28);to=(96,36)]
                out.print(pricenum);
            // end
            // HTML // begin [file="/cart.jsp";from=(96,38);to=(98,0)]
                out.write("元</div></td>\r\n</tr>\r\n");

            // end
            // begin [file="/cart.jsp";from=(98,2);to=(98,3)]
                }
            // end
            // HTML // begin [file="/cart.jsp";from=(98,5);to=(105,0)]
                out.write("\r\n</table>\r\n<p>\r\n<input type=\"submit\" name=\"submit\" value=\"确定购买\">\r\n</p>\r\n</form>\r\n\r\n");

            // end
            // begin [file="/cart.jsp";from=(105,2);to=(106,5)]
                }
                else{
            // end
            // HTML // begin [file="/cart.jsp";from=(106,7);to=(108,0)]
                out.write("\r\n<br><center><h2>Null!</h2></center><br>\r\n");

            // end
            // begin [file="/cart.jsp";from=(108,2);to=(108,3)]
                }
            // end
            // HTML // begin [file="/cart.jsp";from=(108,5);to=(113,7)]
                out.write("\r\n<p>&nbsp;</p>\r\n</table>\r\n</h1>\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 + -