📄 modibook_jsp.java
字号:
package org.apache.jsp.manage;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.bookshop.bean.BookClass;
import com.bookshop.bean.Books;
public final class modibook_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");
out.write("\r\n");
com.bookshop.dao.BookclassList classlist = null;
synchronized (_jspx_page_context) {
classlist = (com.bookshop.dao.BookclassList) _jspx_page_context.getAttribute("classlist", PageContext.PAGE_SCOPE);
if (classlist == null){
classlist = new com.bookshop.dao.BookclassList();
_jspx_page_context.setAttribute("classlist", classlist, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
com.bookshop.dao.Booksmn book = null;
synchronized (_jspx_page_context) {
book = (com.bookshop.dao.Booksmn) _jspx_page_context.getAttribute("book", PageContext.PAGE_SCOPE);
if (book == null){
book = new com.bookshop.dao.Booksmn();
_jspx_page_context.setAttribute("book", book, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
String mesg = "";
String submit = request.getParameter("Submit");
int Id =0;
if (submit!=null && !submit.equals("")){
if(book.getRequest(request)){
if(book.update()){
mesg = "图书资料修改成功!";
} else {
mesg = "数据库操作失败";
}
}else {
mesg = "对不起,你提交的参数有错误";
}
}
if (request.getParameter("id")==null || request.getParameter("id").equals("")) {
mesg = "你要修改的数据参数错误!";
} else {
try {
Id = Integer.parseInt(request.getParameter("id"));
if (!book.getOnebook(Id)){
mesg = "你要修改的数据不存在";
}
} 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("<script language=\"javascript\">\r\n");
out.write(" function checkform() {\r\n");
out.write("\tif (document.form1.id.value==\"\") {\r\n");
out.write("\t\talert(\"你要修改的数据不存在!\");\r\n");
out.write("\t\treturn false;\r\n");
out.write("\t}\r\n");
out.write("\tif (document.form1.bookname.value==\"\") {\r\n");
out.write("\t\tdocument.form1.bookname.focus();\r\n");
out.write("\t\talert(\"图书名为空!\");\r\n");
out.write("\t\treturn false;\r\n");
out.write("\t}\r\n");
out.write("\tif (document.form1.author.value==\"\") {\r\n");
out.write("\t\talert(\"作者名为空!\");\r\n");
out.write("\t\tdocument.form1.author.focus();\r\n");
out.write("\t\treturn false;\r\n");
out.write("\t}\r\n");
out.write("\r\n");
out.write("\treturn true;\r\n");
out.write("\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("</head>\r\n");
out.write("\r\n");
out.write("<body bgcolor=\"#FFCC99\" text=\"#000000\">\r\n");
out.write("<div align=\"center\">\r\n");
out.write(" <table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\" width=\"23%\"><img src=\"../images/javabeans.gif\" width=\"126\" height=\"88\"></td>\r\n");
out.write(" <td align=\"center\" width=\"77%\"><img src=\"../images/baners.gif\" width=\"468\" height=\"60\"></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td align=\"center\" width=\"23%\" valign=\"top\"> \r\n");
out.write(" <table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td align=\"center\"><a href=\"main.jsp\">回管理首页</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\"><a href=\"booklist.jsp\">商店图书查询</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\"><a href=\"addbook.jsp\">添加图书资料</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\"><a href=\"orderlist.jsp\">订单信息查询</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\"><a href=\"userlist.jsp\">用户信息查询</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\"><a href=\"logout.jsp\">退出</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><br>\r\n");
out.write(" <font size=\"3\"><b>修改图书资料</b></font></p>\r\n");
out.write("\t\t ");
if(!mesg.equals("")){
out.println(mesg);
} else {
Books modibook = (Books) book.getBooklist().elementAt(0);
out.write("\r\n");
out.write(" <form name=\"form1\" method=\"post\" action=\"modibook.jsp\">\r\n");
out.write(" <table width=\"90%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\">图书名称:</td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write(" <input type=\"text\" name=\"bookname\" maxlength=\"40\" size=\"30\" value=\"");
out.print( modibook.getBookName() );
out.write("\">\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\">作者:</td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write(" <input type=\"text\" name=\"author\" maxlength=\"25\" size=\"20\" value=\"");
out.print( modibook.getAuthor() );
out.write("\">\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\">出版社:</td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write(" <input type=\"text\" name=\"publish\" size=\"40\" maxlength=\"150\" value=\"");
out.print( modibook.getPublish() );
out.write("\">\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\">所属类别:</td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write(" <select name=\"bookclass\">\r\n");
out.write("\t\t");
if (classlist.excute()){
for (int i=0;i<classlist.getClasslist().size();i++){
BookClass bc = (BookClass) classlist.getClasslist().elementAt(i);
out.write("\r\n");
out.write("\t\t\t <option value=\"");
out.print( bc.getId());
out.write('"');
out.write(' ');
if (bc.getId() == modibook.getBookClass()) out.print("selected");
out.write('>');
out.print( bc.getClassName() );
out.write("</option>\r\n");
out.write("\t\t");
}
}
out.write("\t\r\n");
out.write("\t\t\t\t\t\r\n");
out.write(" </select>\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\">书号:</td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write(" <input type=\"text\" name=\"bookno\" size=\"20\" maxlength=\"30\" value=\"");
out.print( modibook.getBookNo() );
out.write("\">\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\">定价:</td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write(" <input type=\"text\" name=\"price\" size=\"8\" maxlength=\"10\" value=\"");
out.print( modibook.getPrince() );
out.write("\">\r\n");
out.write(" 元</td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\">总数量:</td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write(" <input type=\"text\" name=\"amount\" size=\"8\" maxlength=\"10\" value=\"");
out.print( modibook.getAmount() );
out.write("\">\r\n");
out.write(" 本</td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\" valign=\"top\">图书简介:</td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write(" <textarea name=\"content\" cols=\"40\" rows=\"6\">");
out.print( modibook.getContent() );
out.write("</textarea>\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"right\" width=\"35%\"> </td>\r\n");
out.write(" <td width=\"65%\"> \r\n");
out.write("\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"");
out.print( Id );
out.write("\">\r\n");
out.write(" <input type=\"submit\" name=\"Submit\" value=\"提交\" onclick=\"return(checkform());\">\r\n");
out.write(" <input type=\"reset\" name=\"reset\" value=\"重置\">\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" </form> \r\n");
out.write("\t");
}
out.write("\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(" <br>\r\n");
out.write(" <table width=\"70%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td align=\"center\">51网络有限公司开发<br>\r\n");
out.write(" CopyRight@2008 <br>\r\n");
out.write(" Email:<a href=\"mailto:dengxianghai2008@163.com\">dengxianghai2008@163.com</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" \r\n");
out.write("</div>\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
book.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 + -