📄 _0002fproductslist_0002ejspproductslist_jsp_2.java
字号:
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Vector;
import org.apache.jasper.runtime.*;
import java.beans.*;
import org.apache.jasper.JasperException;
import java.sql.*;
public class _0002fproductsList_0002ejspproductsList_jsp_2 extends HttpJspBase {
// begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(16,0);to=(16,92)]
// end
static {
}
public _0002fproductsList_0002ejspproductsList_jsp_2( ) {
}
private static boolean _jspx_inited = false;
public final void _jspx_init() throws JasperException {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws 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) {
_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="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(0,48);to=(1,0)]
out.write("\r\n"); // end
// begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(1,2);to=(10,0)]
/**
* Title: 使用JSP与JavaBean创建购物车
* Description: 教学示范
* Copyright: Copyright (c) 2003
* Company: 北京师范大学计算机系
* @author 孙一林
* @version 1.0
*/
// end
// HTML // begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(10,2);to=(12,0)]
out.write("\r\n<html>\r\n"); // end
// HTML // begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(12,30);to=(16,0)]
out.write("\r\n<head>\r\n<title>已选商品页面</title>\r\n</head>\r\n"); // end
// begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(16,0);to=(16,92)]
shoppingsystem.shoppingSystemBean selectProduct = null;
boolean _jspx_specialselectProduct = false;
synchronized (session) {
selectProduct= (shoppingsystem.shoppingSystemBean)
pageContext.getAttribute("selectProduct",PageContext.SESSION_SCOPE);
if ( selectProduct == null ) {
_jspx_specialselectProduct = true;
try {
selectProduct = (shoppingsystem.shoppingSystemBean) Beans.instantiate(this.getClass().getClassLoader(), "shoppingsystem.shoppingSystemBean");
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"shoppingsystem.shoppingSystemBean");
}
pageContext.setAttribute("selectProduct", selectProduct, PageContext.SESSION_SCOPE);
}
}
if(_jspx_specialselectProduct == true) {
// end
// begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(16,0);to=(16,92)]
}
// end
// HTML // begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(16,92);to=(16,94)]
out.write(" "); // end
// begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(16,96);to=(16,123)]
/*使用shoppingSystemBean的实例*/
// end
// HTML // begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(16,125);to=(19,0)]
out.write("\r\n\r\n<body bgcolor=\"#FFFFFF\" text=\"#000000\">\r\n"); // end
// begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(19,2);to=(24,0)]
String selected = new String(request.getParameter("productName").getBytes("8859_1")); //获取顾客选择的商品信息
int p_id = Integer.parseInt(selectProduct.trimID(selected)); //从商品信息中解析出所选商品的ID号
String p_name = selectProduct.trimName(selected); //从商品信息中解析出所选商品的名称
float p_price = selectProduct.getPrice(p_id); //获取所选商品的价格
// end
// HTML // begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(24,2);to=(25,62)]
out.write("\r\n<form name=\"form1\" method=\"post\" action=\"customerInfo.jsp?pid="); // end
// begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(25,65);to=(25,69)]
out.print(p_id);
// end
// HTML // begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(25,71);to=(26,0)]
out.write("\">\r\n"); // end
// begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(26,2);to=(36,0)]
out.println("您要选购:<br>");
out.println("<table align=center border=0 width='95%'><tr>");
out.println("<td>商品编号</td>");
out.println("<td>商品名称</td>");
out.println("<td>商品价格</td></tr>");
out.println("<tr><td>" + p_id +"</td>");
out.println("<td>" + p_name +"</td>");
out.println("<td>" + p_price +"</td>");
out.println("</tr></table>");
// end
// HTML // begin [file="D:\\Work\\Java\\ShoppingSystem\\defaultroot\\productsList.jsp";from=(36,2);to=(41,0)]
out.write("\r\n<p align=\"center\"><input type=\"submit\" name=\"Submit\" value=\"确定\" ></p>\r\n</form>\r\n</body>\r\n</html>\r\n"); // end
} catch (Exception ex) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(ex);
} finally {
if (out != null) out.flush();
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -