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

📄 category_0002ejsp_jsp.java

📁 购物车模块实例。购物车模块可以浏览商品类别;可以根据商品类别浏览商品信息;可以购买商品;可以查看购物车的商品;可以修改购买商品的数量和删除购买的商品。
💻 JAVA
字号:
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class category_0002ejsp_jsp extends HttpJspBase {

    // begin [file="/category.jsp";from=(5,0);to=(5,67)]
    // end

    static {
    }
    public category_0002ejsp_jsp( ) {
    }

    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="/category.jsp";from=(0,48);to=(5,0)]
                out.write("\r\n<html>\r\n<head>\r\n<title>商品浏览页面</title>\r\n</head>\r\n");

            // end
            // begin [file="/category.jsp";from=(5,0);to=(5,67)]
                data.CartData cartData = null;
                boolean _jspx_specialcartData  = false;
                 synchronized (session) {
                    cartData= (data.CartData)
                    pageContext.getAttribute("cartData",PageContext.SESSION_SCOPE);
                    if ( cartData == null ) {
                        _jspx_specialcartData = true;
                        try {
                            cartData = (data.CartData) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "data.CartData");
                        } catch (ClassNotFoundException exc) {
                             throw new InstantiationException(exc.getMessage());
                        } catch (Exception exc) {
                             throw new ServletException (" Cannot create bean of class "+"data.CartData", exc);
                        }
                        pageContext.setAttribute("cartData", cartData, PageContext.SESSION_SCOPE);
                    }
                 } 
                if(_jspx_specialcartData == true) {
            // end
            // begin [file="/category.jsp";from=(5,0);to=(5,67)]
                }
            // end
            // HTML // begin [file="/category.jsp";from=(5,67);to=(15,0)]
                out.write("\r\n<body>\r\n<center>\r\n<h3>商品浏览页面</h3>\r\n<table cellpadding=\"10\" cellspacing=\"0\" border = \"1\">\r\n  <tr align=\"center\">\r\n    <td>序号</td>\r\n    <td>类别名字</td>\r\n    <td>类别描述</td>\r\n  </tr>\r\n");

            // end
            // begin [file="/category.jsp";from=(15,2);to=(20,0)]
                
                //取得商品类别数组
                String[][] categories = cartData.getCategory();
                for(int i=0; i < categories.length; i++){
                  if(categories[0].length > 1){
            // end
            // HTML // begin [file="/category.jsp";from=(20,2);to=(23,10)]
                out.write("\r\n    <!--通过表格显示商品类别数组的数据-->\r\n    <tr>\r\n      <td>");

            // end
            // begin [file="/category.jsp";from=(23,13);to=(23,20)]
                out.print((i + 1));
            // end
            // HTML // begin [file="/category.jsp";from=(23,22);to=(25,40)]
                out.write("</td>\r\n      <td>\r\n        <a href=\"product.jsp?categoryId=");

            // end
            // begin [file="/category.jsp";from=(25,43);to=(25,59)]
                out.print(categories[i][0]);
            // end
            // HTML // begin [file="/category.jsp";from=(25,61);to=(25,75)]
                out.write("&categoryName=");

            // end
            // begin [file="/category.jsp";from=(25,78);to=(25,94)]
                out.print(categories[i][1]);
            // end
            // HTML // begin [file="/category.jsp";from=(25,96);to=(26,10)]
                out.write("\">\r\n          ");

            // end
            // begin [file="/category.jsp";from=(26,13);to=(26,29)]
                out.print(categories[i][1]);
            // end
            // HTML // begin [file="/category.jsp";from=(26,31);to=(29,10)]
                out.write("\r\n        </a>\r\n      </td>\r\n      <td>");

            // end
            // begin [file="/category.jsp";from=(29,13);to=(29,29)]
                out.print(categories[i][2]);
            // end
            // HTML // begin [file="/category.jsp";from=(29,31);to=(31,0)]
                out.write("</td>\r\n    </tr>\r\n");

            // end
            // begin [file="/category.jsp";from=(31,2);to=(32,8)]
                
                  }else{
            // end
            // HTML // begin [file="/category.jsp";from=(32,10);to=(33,24)]
                out.write("\r\n    <tr><td colspan=\"3\">");

            // end
            // begin [file="/category.jsp";from=(33,27);to=(33,43)]
                out.print(categories[i][0]);
            // end
            // HTML // begin [file="/category.jsp";from=(33,45);to=(34,0)]
                out.write("</td></tr>\r\n");

            // end
            // begin [file="/category.jsp";from=(34,2);to=(37,0)]
                
                  }
                }
            // end
            // HTML // begin [file="/category.jsp";from=(37,2);to=(41,7)]
                out.write("\r\n</table>\r\n</center>\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 + -