📄 showcart_0002ejsp_jsp.java
字号:
import bookshoppingsys.*;
import java.util.Properties;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class showcart_0002ejsp_jsp extends HttpJspBase {
// begin [file="/common.jsp";from=(3,0);to=(3,77)]
// end
// begin [file="/common.jsp";from=(4,3);to=(10,0)]
public String convert(String s){
try{
return new String(s.getBytes("ISO-8859-1"),"GB2312");
}catch(Exception e){return null;}
}
// end
// begin [file="/showcart.jsp";from=(3,0);to=(3,77)]
// end
static {
}
public showcart_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=GB2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
"errorpage.jsp", true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
// HTML // begin [file="/showcart.jsp";from=(0,51);to=(1,0)]
out.write("\r\n");
// end
// HTML // begin [file="/common.jsp";from=(0,38);to=(1,0)]
out.write("\r\n");
// end
// HTML // begin [file="/common.jsp";from=(1,37);to=(2,0)]
out.write("\r\n");
// end
// HTML // begin [file="/common.jsp";from=(2,41);to=(3,0)]
out.write("\r\n");
// end
// begin [file="/common.jsp";from=(3,0);to=(3,77)]
bookshoppingsys.BookDB bookDB = null;
boolean _jspx_specialbookDB = false;
synchronized (application) {
bookDB= (bookshoppingsys.BookDB)
pageContext.getAttribute("bookDB",PageContext.APPLICATION_SCOPE);
if ( bookDB == null ) {
_jspx_specialbookDB = true;
try {
bookDB = (bookshoppingsys.BookDB) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "bookshoppingsys.BookDB");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"bookshoppingsys.BookDB", exc);
}
pageContext.setAttribute("bookDB", bookDB, PageContext.APPLICATION_SCOPE);
}
}
if(_jspx_specialbookDB == true) {
// end
// begin [file="/common.jsp";from=(3,0);to=(3,77)]
}
// end
// HTML // begin [file="/common.jsp";from=(3,77);to=(4,0)]
out.write("\r\n");
// end
// HTML // begin [file="/common.jsp";from=(10,2);to=(12,0)]
out.write("\r\n\r\n");
// end
// HTML // begin [file="/showcart.jsp";from=(1,32);to=(2,0)]
out.write("\r\n");
// end
// HTML // begin [file="/showcart.jsp";from=(2,32);to=(3,0)]
out.write("\r\n");
// end
// begin [file="/showcart.jsp";from=(3,0);to=(3,77)]
bookshoppingsys.ShoppingCart cart = null;
boolean _jspx_specialcart = false;
synchronized (session) {
cart= (bookshoppingsys.ShoppingCart)
pageContext.getAttribute("cart",PageContext.SESSION_SCOPE);
if ( cart == null ) {
_jspx_specialcart = true;
try {
cart = (bookshoppingsys.ShoppingCart) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "bookshoppingsys.ShoppingCart");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"bookshoppingsys.ShoppingCart", exc);
}
pageContext.setAttribute("cart", cart, PageContext.SESSION_SCOPE);
}
}
if(_jspx_specialcart == true) {
// end
// begin [file="/showcart.jsp";from=(3,0);to=(3,77)]
}
// end
// HTML // begin [file="/showcart.jsp";from=(3,77);to=(5,0)]
out.write("\r\n<html>\r\n");
// end
// begin [file="/showcart.jsp";from=(5,2);to=(10,0)]
String bookname = convert((String)request.getParameter("Remove"));
if (bookname != null) {
cart.remove(bookname);
BookDetails book = bookDB.getBookDetails(bookname);
// end
// HTML // begin [file="/showcart.jsp";from=(10,2);to=(12,41)]
out.write("\r\n\r\n<font color=\"red\" size=\"+2\">您已删除了一本书:<em>");
// end
// begin [file="/showcart.jsp";from=(12,44);to=(12,63)]
out.print(book.getBook_name());
// end
// HTML // begin [file="/showcart.jsp";from=(12,65);to=(16,0)]
out.write("\r\n</em>\r\n<br> <br>\r\n</font>\r\n");
// end
// begin [file="/showcart.jsp";from=(16,2);to=(20,0)]
}
if (convert((String)request.getParameter("Clear")) != null) {
cart.clear();
// end
// HTML // begin [file="/showcart.jsp";from=(20,2);to=(24,0)]
out.write("\r\n<font color=\"red\" size=\"+2\"><strong>\r\n清空购物车\r\n</strong><br> <br></font>\r\n");
// end
// begin [file="/showcart.jsp";from=(24,2);to=(29,0)]
}
// Print a summary of the shopping cart
int num = cart.getNumberOfItems();
if (num > 0) {
// end
// HTML // begin [file="/showcart.jsp";from=(29,2);to=(30,21)]
out.write("\r\n<font size=\"+2\">您已购买了");
// end
// begin [file="/showcart.jsp";from=(30,24);to=(30,27)]
out.print(num);
// end
// HTML // begin [file="/showcart.jsp";from=(30,29);to=(38,0)]
out.write("本书\r\n</font><br> \r\n<table>\r\n<tr>\r\n<th align=center width=\"80\">数量</th>\r\n<th align=center width=\"150\">书名</th>\r\n<th align=center width=\"80\">价格</th>\r\n</tr>\r\n");
// end
// begin [file="/showcart.jsp";from=(38,2);to=(43,0)]
Iterator i = cart.getItems().iterator();
while (i.hasNext()) {
ShoppingCartItem item = (ShoppingCartItem)i.next();
BookDetails book = (BookDetails)item.getItem();
// end
// HTML // begin [file="/showcart.jsp";from=(43,2);to=(46,19)]
out.write("\r\n\r\n<tr>\r\n<td align=\"center\">");
// end
// begin [file="/showcart.jsp";from=(46,22);to=(46,40)]
out.print(item.getQuantity());
// end
// HTML // begin [file="/showcart.jsp";from=(46,42);to=(47,36)]
out.write("</td>\r\n<td align=\"center\"><strong><a href=\"");
// end
// begin [file="/showcart.jsp";from=(47,39);to=(47,63)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/showcart.jsp";from=(47,65);to=(47,91)]
out.write("/bookdetails.jsp?bookname=");
// end
// begin [file="/showcart.jsp";from=(47,94);to=(47,113)]
out.print(book.getBook_name());
// end
// HTML // begin [file="/showcart.jsp";from=(47,115);to=(47,117)]
out.write("\">");
// end
// begin [file="/showcart.jsp";from=(47,120);to=(47,139)]
out.print(book.getBook_name());
// end
// HTML // begin [file="/showcart.jsp";from=(47,141);to=(48,19)]
out.write("</a></strong></td>\r\n<td align=\"center\">");
// end
// begin [file="/showcart.jsp";from=(48,22);to=(48,39)]
out.print(book.getT_value());
// end
// HTML // begin [file="/showcart.jsp";from=(48,41);to=(49,35)]
out.write("</td>\r\n<td><font color=\"#111111\"><a href=\"");
// end
// begin [file="/showcart.jsp";from=(49,38);to=(49,62)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/showcart.jsp";from=(49,64);to=(49,85)]
out.write("/showcart.jsp?Remove=");
// end
// begin [file="/showcart.jsp";from=(49,88);to=(49,107)]
out.print(book.getBook_name());
// end
// HTML // begin [file="/showcart.jsp";from=(49,109);to=(50,0)]
out.write("\">删除</a></font></td></tr>\r\n");
// end
// begin [file="/showcart.jsp";from=(50,2);to=(52,0)]
}
// end
// HTML // begin [file="/showcart.jsp";from=(52,2);to=(56,19)]
out.write("\r\n<tr><td colspan=\"5\" bgcolor=\"#ffffff\"><br></td></tr>\r\n<tr>\r\n<td colspan=\"2\" align=\"right\">总额(元):</td>\r\n<td align=\"center\">");
// end
// begin [file="/showcart.jsp";from=(56,22);to=(56,37)]
out.print(cart.getTotal());
// end
// HTML // begin [file="/showcart.jsp";from=(56,39);to=(61,14)]
out.write("</td>\r\n<td><br></td>\r\n</tr>\r\n<p>\r\n</table>\r\n<form action=\"");
// end
// begin [file="/showcart.jsp";from=(61,17);to=(61,41)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/showcart.jsp";from=(61,43);to=(63,9)]
out.write("/catalog.jsp\"><input type=\"image\" src=\"images//goonbuy.gif\"></form> \r\n<p>\r\n<a href=\"");
// end
// begin [file="/showcart.jsp";from=(63,12);to=(63,36)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/showcart.jsp";from=(63,38);to=(64,9)]
out.write("/cashier.jsp\">提交账单</a> \r\n<a href=\"");
// end
// begin [file="/showcart.jsp";from=(64,12);to=(64,36)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/showcart.jsp";from=(64,38);to=(65,0)]
out.write("/showcart.jsp?Clear=clear\">清空购物车</a></strong>\r\n");
// end
// begin [file="/showcart.jsp";from=(65,2);to=(67,0)]
} else {
// end
// HTML // begin [file="/showcart.jsp";from=(67,2);to=(70,14)]
out.write("\r\n<font size=\"+2\">您还没有进行购物!</font>\r\n<br> <br>\r\n<form action=\"");
// end
// begin [file="/showcart.jsp";from=(70,17);to=(70,41)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/showcart.jsp";from=(70,43);to=(72,0)]
out.write("/catalog.jsp\"><input type=\"image\" src=\"images//goonbuy.gif\"></form> \r\n\r\n");
// end
// begin [file="/showcart.jsp";from=(72,2);to=(75,0)]
// End of if
}
// end
// HTML // begin [file="/showcart.jsp";from=(75,2);to=(79,0)]
out.write("\r\n</body>\r\n</html>\r\n\r\n");
// 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 + -