📄 booklist_jsp.java
字号:
package org.apache.jsp.manage;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.bookshop.bean.*;
public final class booklist_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List _jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
public void _jspDestroy() {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
if (session.getAttribute("admin")==null || session.getAttribute("admin")==""){
response.sendRedirect("error.htm");
}
out.write("\r\n");
out.write("\r\n");
com.bookshop.dao.Booksmn book_list = null;
synchronized (_jspx_page_context) {
book_list = (com.bookshop.dao.Booksmn) _jspx_page_context.getAttribute("book_list", PageContext.PAGE_SCOPE);
if (book_list == null){
book_list = new com.bookshop.dao.Booksmn();
_jspx_page_context.setAttribute("book_list", book_list, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
int pages=1;
String mesg = "";
if (request.getParameter("action")!=null && request.getParameter("action").equals("del")){
try {
int delid = Integer.parseInt(request.getParameter("id"));
if (book_list.delete(delid)){
mesg = "删除成功!";
} else {
mesg = "删除出错!";
}
} catch (Exception e){
mesg = "你要删除的对象错误!";
}
}
if (request.getParameter("page")!=null && !request.getParameter("page").equals("")) {
String requestpage = request.getParameter("page");
try {
pages = Integer.parseInt(requestpage);
} catch(Exception e) {
mesg = "你要找的页码错误!";
}
}
out.write("\r\n");
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<title>51网上书店管理系统</title>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
out.write("<style>a{TEXT-DECORATION:none}a:hover{TEXT-DECORATION:underline}</style>\r\n");
out.write("<script language=\"JavaScript\">\r\n");
out.write("\t\tsetInterval(\"a.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());\",1000);\r\n");
out.write("\t\t</script>\r\n");
out.write("<script language=\"javascript\">\r\n");
out.write("<script language=\"javascript\">\r\n");
out.write("function openScript(url,name, width, height){\r\n");
out.write("\tvar Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );\r\n");
out.write("}\r\n");
out.write("</script>\r\n");
out.write("<link rel=\"stylesheet\" href=\"books.css\" type=\"text/css\">\r\n");
out.write("<style type=\"text/css\">\r\n");
out.write("<!--\r\n");
out.write(".style14 {color: #3366FF}\r\n");
out.write(".style16 {font-size: 18px; color: #3366FF;}\r\n");
out.write(".style17 {font-size: 14px}\r\n");
out.write(".style18 {color: #3366FF; font-size: 14px; }\r\n");
out.write(".style20 {color: #3366FF; font-size: 16; }\r\n");
out.write(".style21 {font-size: 16; }\r\n");
out.write("-->\r\n");
out.write("</style>\r\n");
out.write("</head>\r\n");
out.write("\r\n");
out.write("<body text=\"#000000\">\r\n");
out.write("\t\t<div align=\"center\">\r\n");
out.write("\t\t\t<table width=\"750\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write("\t\t\t\t<tr>\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t<td align=\"center\"><img src=\"../images/title.jpg\" width=\"744\" height=\"100\"></td>\r\n");
out.write("\t\t\t\t</tr>\r\n");
out.write("\t\t\t</table>\r\n");
out.write("\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\t<table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" >\r\n");
out.write("\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t <td width=\"100\" height=\"30\" align=\"center\" background=\"../images/qntj.jpg\" class=\"style14\"><a href=\"../index.jsp\" class=\"style18\">首页</a></td>\r\n");
out.write("\t\t\t\t <td width=\"100\" align=\"center\" background=\"../images/qntj.jpg\" class=\"style14\"><a href=\"../booklist.jsp\" class=\"style18\">在线购物</a></td>\r\n");
out.write("\t\t\t\t <td width=\"100\" align=\"center\" background=\"../images/qntj.jpg\" class=\"style14\"><a href=\"../shoperlist.jsp\" class=\"style18\">我的购物车</a></td>\r\n");
out.write("\t\t\t\t <td width=\"100\" align=\"center\" background=\"../images/qntj.jpg\" class=\"style14\"><a href=\"../login.jsp\" class=\"style18\">用户登录</a></td>\r\n");
out.write("\t\t\t\t <td width=\"100\" align=\"center\" background=\"../images/qntj.jpg\" class=\"style14\"><a href=\"../manage/login.jsp\" class=\"style14 style17\">网站管理</a></td>\r\n");
out.write("\t\t\t\t <td width=\"250\" align=\"center\" background=\"../images/qntj.jpg\"><div id=\"a\"><span class=\"style7\"></span></div></td>\r\n");
out.write("\t\t\t\t</tr>\r\n");
out.write("\t\t </table>\r\n");
out.write("\t\t \r\n");
out.write(" <p> </p>\r\n");
out.write(" <div align=\"center\">\r\n");
out.write(" <table width=\"750\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> \r\n");
out.write(" <tr>\r\n");
out.write(" <td align=\"center\" width=\"23%\" valign=\"top\"> \r\n");
out.write(" <table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td height=\"30\"> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"30\" align=\"center\" class=\"style14\"><a href=\"main.jsp\" class=\"style21\">回管理首页</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td height=\"30\" align=\"center\" class=\"style14\"><a href=\"booklist.jsp\" class=\"style21\">商店图书查询</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td height=\"30\" align=\"center\" class=\"style14\"><a href=\"addbook.jsp\" class=\"style21\">添加图书资料</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td height=\"30\" align=\"center\" class=\"style14\"><a href=\"orderlist.jsp\" class=\"style21\">订单信息查询</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td height=\"30\" align=\"center\" class=\"style14\"><a href=\"userlist.jsp\" class=\"style20\">用户信息查询</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td height=\"30\" align=\"center\" class=\"style14\"><a href=\"logout.jsp\" class=\"style21\">退出</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" </td>\r\n");
out.write(" <td align=\"center\" width=\"77%\">\r\n");
out.write(" <p> ");
if (!mesg.equals("")) out.println(mesg);
out.write("</p>\r\n");
out.write(" <p class=\"style16\">51书店当前图书情况:</p>\r\n");
out.write(" <table width=\"90%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#CC0000\">\r\n");
out.write(" <tr align=\"center\"> \r\n");
out.write(" <td height=\"35\">编号</td>\r\n");
out.write(" <td>图书名</td>\r\n");
out.write(" <td>作者</td>\r\n");
out.write(" <td>类别</td>\r\n");
out.write(" <td>单价</td>\r\n");
out.write(" <td>总数量</td>\r\n");
out.write(" <td>剩余数</td>\r\n");
out.write(" <td>动作</td>\r\n");
out.write(" </tr>\r\n");
if (book_list.execute(request)) {
for (int i=0;i<book_list.getBooklist().size();i++){
Books bk = (Books) book_list.getBooklist().elementAt(i);
out.write("\r\n");
out.write(" <tr> \r\n");
out.write(" <td height=\"33\" align=\"center\">");
out.print(bk.getId() );
out.write("</td>\r\n");
out.write(" <td><a href=\"#\" onclick=\"openScript('showbook.jsp?bookid=");
out.print( bk.getId() );
out.write("','sbook',450,500);\">");
out.print( bk.getBookName() );
out.write("</a></td>\r\n");
out.write(" <td align=\"center\">");
out.print( bk.getAuthor() );
out.write("</td>\r\n");
out.write(" <td align=\"center\">");
out.print( bk.getClassname() );
out.write("</td>\r\n");
out.write(" <td align=\"center\">");
out.print( bk.getPrince() );
out.write("</td>\r\n");
out.write(" <td align=\"center\">");
out.print( bk.getAmount() );
out.write("</td>\r\n");
out.write(" <td align=\"center\">");
out.print( bk.getLeav_number() );
out.write("</td>\r\n");
out.write(" <td align=\"center\"><a href=\"modibook.jsp?id=");
out.print( bk.getId() );
out.write("\">修改</a> <a href=\"booklist.jsp?action=del&page=");
out.print( pages );
out.write("&id=");
out.print( bk.getId() );
out.write("\" onclick=\"confirm('真的要删除吗');\">删除</a></td>\r\n");
out.write(" </tr>\r\n");
}
} else {
out.write("\r\n");
out.write(" <tr> \r\n");
out.write(" <td height=\"34\" colspan=8 align=\"center\"> 网站正在维护中,请稍后......</td>\r\n");
out.write(" \r\n");
out.write(" </tr>\r\n");
}
out.write("\r\n");
out.write(" </table>\r\n");
out.write(" <br>\r\n");
out.write(" <table width=\"89%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"34\" align=\"right\">当前页第");
out.print( book_list.getPage() );
out.write("页 <a href=\"booklist.jsp\">首页</a> \r\n");
out.write("\t");
if (book_list.getPage()>1) {
out.write("<a href=\"booklist.jsp?page=");
out.print( book_list.getPage()-1 );
out.write("\">上一页</a> ");
}
out.write('\r');
out.write('\n');
out.write(' ');
if (book_list.getPage()<book_list.getPageCount()-1) {
out.write("<a href=\"booklist.jsp?page=");
out.print( book_list.getPage()+1 );
out.write("\">下一页</a> ");
}
out.write("\r\n");
out.write("\t\t\t<a href=\"booklist.jsp?page=");
out.print( book_list.getPageCount() );
out.write("\">未页</a> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" <p> </p>\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <hr width=\"750\" color=\"#00CCFe\"/>\r\n");
out.write("\t\t\t<table width=\"750\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write("\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t<td align=\"center\" >\r\n");
out.write("\t\t\t\t\t\t<div align=\"center\" class=\"style11\">51网络有限公司开发\r\n");
out.write("\t\t\t\t\t\t <br>\r\n");
out.write("\t\t\t\t\t\tCopyRight@2008\r\n");
out.write("\t\t\t\t\t\t<br>\r\n");
out.write("\t\t\t\t\t\tE-mail:\r\n");
out.write("\t\t\t\t\t\t<a href=\"mailto:dengxianghai2005@163.com\">dengxianghai2005@163.com</a>\r\n");
out.write("\t\t\t\t\t </div></td>\r\n");
out.write("\t\t\t\t</tr>\r\n");
out.write("\t\t\t</table>\r\n");
out.write(" \r\n");
out.write("</div>\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
book_list.close();
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -