📄 productlist_0002ejsp_jsp.java
字号:
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class productList_0002ejsp_jsp extends HttpJspBase {
// begin [file="/productList.jsp";from=(13,0);to=(13,96)]
// end
static {
}
public productList_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();
// begin [file="/productList.jsp";from=(0,2);to=(9,0)]
/**
* Title: 商店购物管理系统的完整实现
* Description: 教学示范
* Copyright: Copyright (c) 2003
* Company: 北京师范大学计算机系
* @author 孙一林
* @version 1.0
*/
// end
// HTML // begin [file="/productList.jsp";from=(9,2);to=(10,0)]
out.write("\r\n");
// end
// HTML // begin [file="/productList.jsp";from=(10,48);to=(12,0)]
out.write("\r\n<html>\r\n");
// end
// HTML // begin [file="/productList.jsp";from=(12,30);to=(13,0)]
out.write("\r\n");
// end
// begin [file="/productList.jsp";from=(13,0);to=(13,96)]
shopmanagesystem.shopManageSystemBean shopManageBean = null;
boolean _jspx_specialshopManageBean = false;
synchronized (session) {
shopManageBean= (shopmanagesystem.shopManageSystemBean)
pageContext.getAttribute("shopManageBean",PageContext.SESSION_SCOPE);
if ( shopManageBean == null ) {
_jspx_specialshopManageBean = true;
try {
shopManageBean = (shopmanagesystem.shopManageSystemBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "shopmanagesystem.shopManageSystemBean");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"shopmanagesystem.shopManageSystemBean", exc);
}
pageContext.setAttribute("shopManageBean", shopManageBean, PageContext.SESSION_SCOPE);
}
}
if(_jspx_specialshopManageBean == true) {
// end
// begin [file="/productList.jsp";from=(13,0);to=(13,96)]
}
// end
// HTML // begin [file="/productList.jsp";from=(13,96);to=(13,98)]
out.write(" ");
// end
// begin [file="/productList.jsp";from=(13,100);to=(13,129)]
/*使用shopManageSystemBean的实例*/
// end
// HTML // begin [file="/productList.jsp";from=(13,131);to=(20,2)]
out.write("\r\n<head>\r\n<title>查看库存商品</title>\r\n</head>\r\n<body>\r\n<h1 align=\"center\">库存商品列表</h1>\r\n<p>\r\n ");
// end
// begin [file="/productList.jsp";from=(20,4);to=(49,0)]
try
{
ResultSet rs = shopManageBean.getProductList(); //获取库存商品信息
out.println("<table width=75% border=1 align=center><tr>"); //列出库存商品表格的表头
out.println("<td align=center>产品编号</td>");
out.println("<td align=center>产品名称</td>");
out.println("<td align=center>产品价格</td>");
out.println("<td align=center>库存数量</td>");
out.println("</tr>");
while(rs.next()) //列出库存商品信息
{
String productID = rs.getString("product_id");
String productName = rs.getString("product_name");
String productPrice = rs.getString("product_price");
String productQuantity = rs.getString("product_quantity");
out.println("<tr>");
out.println("<td align=center>" + productID + "</td>");
out.println("<td align=center>" + productName + "</td>");
out.println("<td align=center>" + productPrice + "</td>");
out.println("<td align=center>" + productQuantity + "</td>");
out.println("</tr>");
}
out.println("</table>");
}
catch(Exception ex) //捕捉异常
{
ex.printStackTrace();
}
// end
// HTML // begin [file="/productList.jsp";from=(49,2);to=(73,0)]
out.write("\r\n</p>\r\n<div align=\"center\">\r\n <table width=\"90%\" border=\"0\">\r\n <tr>\r\n <td align=\"center\"><a href=insertProduct.htm>插入新的商品</a></td>\r\n <td align=\"center\">\r\n <form name=\"form1\" method=\"post\" action=\"showProductInfo.jsp\">\r\n 请输入商品编号:\r\n <input type=\"text\" name=\"updateProductID\">\r\n <input type=\"submit\" name=\"Submit\" value=\"修改此商品信息\">\r\n </form></td>\r\n <td align=\"center\">\r\n <form name=\"form2\" method=\"post\" action=\"delProduct.jsp\">\r\n 请输入商品编号:\r\n <input type=\"text\" name=\"delProductID\">\r\n <input type=\"submit\" name=\"Submit\" value=\"删除此商品信息\">\r\n </form></td>\r\n </tr>\r\n </table>\r\n</div>\r\n<p> </p>\r\n\r\n<p> </p>\r\n");
// end
// begin [file="/productList.jsp";from=(73,2);to=(76,0)]
out.println("<p align=center><a href=productSold.jsp>处理货物售出表</a></p>");
out.println("<p align=center><a href=customerDeal.jsp>处理用户购买表</a></p>");
// end
// HTML // begin [file="/productList.jsp";from=(76,2);to=(78,7)]
out.write("\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 + -