📄 catalog_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 catalog_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="/catalog.jsp";from=(3,0);to=(3,77)]
// end
static {
}
public catalog_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="/catalog.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="/catalog.jsp";from=(1,32);to=(2,0)]
out.write("\r\n");
// end
// HTML // begin [file="/catalog.jsp";from=(2,32);to=(3,0)]
out.write("\r\n");
// end
// begin [file="/catalog.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="/catalog.jsp";from=(3,0);to=(3,77)]
}
// end
// HTML // begin [file="/catalog.jsp";from=(3,77);to=(5,0)]
out.write("\r\n<html>\r\n");
// end
// begin [file="/catalog.jsp";from=(5,2);to=(12,0)]
// Additions to the shopping cart
String book_name =convert(request.getParameter("Add"));
// System.out.println(book_name);
if (book_name != null) {
BookDetails book = bookDB.getBookDetails(book_name);
cart.add(book_name, book);
// end
// HTML // begin [file="/catalog.jsp";from=(12,2);to=(14,37)]
out.write("\r\n<p><h3>\r\n您已将 <font color=\"#00abcd\">");
// end
// begin [file="/catalog.jsp";from=(14,40);to=(14,59)]
out.print(book.getBook_name());
// end
// HTML // begin [file="/catalog.jsp";from=(14,61);to=(15,0)]
out.write("</font> 放入了购物车!</h3>\r\n");
// end
// begin [file="/catalog.jsp";from=(15,2);to=(18,0)]
}
if (cart.getNumberOfItems() > 0) {
// end
// HTML // begin [file="/catalog.jsp";from=(18,2);to=(19,20)]
out.write("\r\n<p><strong><a href=\"");
// end
// begin [file="/catalog.jsp";from=(19,23);to=(19,47)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/catalog.jsp";from=(19,49);to=(20,9)]
out.write("/showcart.jsp\">查看购物车</a> </p>\r\n<a href=\"");
// end
// begin [file="/catalog.jsp";from=(20,12);to=(20,36)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/catalog.jsp";from=(20,38);to=(21,0)]
out.write("/cashier.jsp\">提交账单</a></p></strong>\r\n");
// end
// begin [file="/catalog.jsp";from=(21,2);to=(23,0)]
}
// end
// HTML // begin [file="/catalog.jsp";from=(23,2);to=(26,0)]
out.write("\r\n<img src=\"images\\\\buybook.gif\">\r\n<table>\r\n");
// end
// begin [file="/catalog.jsp";from=(26,2);to=(33,0)]
//String tt_username=session.getAttribute("t_username") ;
Collection c = bookDB.getBooks();
Iterator i = c.iterator();
while (i.hasNext()) {
BookDetails book = (BookDetails)i.next();
book_name = book.getBook_name();
// end
// HTML // begin [file="/catalog.jsp";from=(33,2);to=(36,9)]
out.write("\r\n<tr>\r\n<td>\r\n<a href=\"");
// end
// begin [file="/catalog.jsp";from=(36,12);to=(36,36)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/catalog.jsp";from=(36,38);to=(36,64)]
out.write("/bookdetails.jsp?bookname=");
// end
// begin [file="/catalog.jsp";from=(36,67);to=(36,86)]
out.print(book.getBook_name());
// end
// HTML // begin [file="/catalog.jsp";from=(36,88);to=(37,0)]
out.write("\"><strong>\r\n");
// end
// begin [file="/catalog.jsp";from=(37,3);to=(37,22)]
out.print(book.getBook_name());
// end
// HTML // begin [file="/catalog.jsp";from=(37,24);to=(39,0)]
out.write(" </strong></a></td>\r\n<td rowspan=2>\r\n");
// end
// begin [file="/catalog.jsp";from=(39,2);to=(39,48)]
if(session.getAttribute("t_username")!=null ){
// end
// HTML // begin [file="/catalog.jsp";from=(39,50);to=(40,14)]
out.write("\r\n<form action=\"");
// end
// begin [file="/catalog.jsp";from=(40,17);to=(40,41)]
out.print(request.getContextPath());
// end
// HTML // begin [file="/catalog.jsp";from=(40,43);to=(40,60)]
out.write("/catalog.jsp?Add=");
// end
// begin [file="/catalog.jsp";from=(40,63);to=(40,82)]
out.print(book.getBook_name());
// end
// HTML // begin [file="/catalog.jsp";from=(40,84);to=(42,0)]
out.write("\" method=\"post\"><input type=\"image\" src=\"images//putcart.jpg\"></form>\r\n</td></tr>\r\n");
// end
// begin [file="/catalog.jsp";from=(42,2);to=(43,6)]
}
else {
// end
// HTML // begin [file="/catalog.jsp";from=(43,8);to=(44,0)]
out.write("\r\n");
// end
// begin [file="/catalog.jsp";from=(44,0);to=(44,36)]
if (true) {
out.clear();
String _jspx_qfStr = "";
pageContext.forward("OrderWrong.jsp" + _jspx_qfStr);
return;
}
// end
// HTML // begin [file="/catalog.jsp";from=(44,36);to=(45,0)]
out.write("\r\n");
// end
// begin [file="/catalog.jsp";from=(45,2);to=(45,3)]
}
// end
// HTML // begin [file="/catalog.jsp";from=(45,5);to=(48,19)]
out.write("\r\n<tr>\r\n<td>\r\n 作者:<em>");
// end
// begin [file="/catalog.jsp";from=(48,22);to=(48,38)]
out.print(book.getAuthor());
// end
// HTML // begin [file="/catalog.jsp";from=(48,40);to=(50,0)]
out.write(" \r\n</em></td></tr>\r\n");
// end
// begin [file="/catalog.jsp";from=(50,2);to=(50,5)]
}
// end
// HTML // begin [file="/catalog.jsp";from=(50,7);to=(54,0)]
out.write("\r\n</table>\r\n</body>\r\n</html>\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 + -