⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchbook_005fpost_jsp.java

📁 实现基本的书店管理
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import java.sql.*;
import java.sql.*;

public final class searchbook_005fpost_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.List _jspx_dependants;

  static {
    _jspx_dependants = new java.util.ArrayList(2);
    _jspx_dependants.add("/top.jsp");
    _jspx_dependants.add("/bottom.jsp");
  }

  public Object getDependants() {
    return _jspx_dependants;
  }

  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;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=gb2312");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", 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');
      out.write('\n');
      conndb.DbConnBean search = null;
      synchronized (request) {
        search = (conndb.DbConnBean) _jspx_page_context.getAttribute("search", PageContext.REQUEST_SCOPE);
        if (search == null){
          search = new conndb.DbConnBean();
          _jspx_page_context.setAttribute("search", search, PageContext.REQUEST_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');

String sql="";
String keyword=request.getParameter("keyword");//接受请求的参数
String tkeyword=search.chStr(keyword);//解决中文乱码
String keytype=request.getParameter("type");
if(keytype.equals("booktitle")){sql="select * from book where title like '%"+tkeyword+"%'";}
else if(keytype.equals("bookid")){sql="select * from book where bookID like '%"+tkeyword+"%'";}
Connection conn=search.getConn();
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
String color="#CCCCCC";
int id=0;

      out.write("\r\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<title>图书查询结果</title>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write('\r');
      out.write('\n');
      DateBean.MyDate showdate = null;
      synchronized (_jspx_page_context) {
        showdate = (DateBean.MyDate) _jspx_page_context.getAttribute("showdate", PageContext.PAGE_SCOPE);
        if (showdate == null){
          showdate = new DateBean.MyDate();
          _jspx_page_context.setAttribute("showdate", showdate, PageContext.PAGE_SCOPE);
        }
      }
      out.write("\r\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n");
      out.write("\"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write("body {\r\n");
      out.write("\tbackground-color: #FFFFFF;\r\n");
      out.write("\tmargin-left: 0px;\r\n");
      out.write("\tmargin-top: 0px;\r\n");
      out.write("\tmargin-right: 0px;\r\n");
      out.write("\tmargin-bottom: 0px;\r\n");
      out.write("}\r\n");
      out.write(".bannnername {\r\n");
      out.write("\tfont-size: 50px;\r\n");
      out.write("\tcolor: #000000;\r\n");
      out.write("\tfont-weight: bold;\r\n");
      out.write("\tfont-family: \"黑体\";\r\n");
      out.write("}\r\n");
      out.write(".style3 {font-size: 12px}\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<table width=\"72%\"  border=\"0\" align=\"center\" bgcolor=\"99CCCC\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"10\"></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("<table width=\"72%\" height=\"88\"  border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td width=\"245\" height=\"88\" valign=\"top\"><img src=\"images/top.gif\"></td>\r\n");
      out.write("    <td width=\"365\" align=\"left\" valign=\"top\">\r\n");
      out.write("      <marquee direction=\"left\" scrolldelay=\"100\">\r\n");
      out.write("    </marquee>      \r\n");
      out.write("    <table width=\"100%\"  border=\"0\">\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td><img src=\"images/banner.gif\" width=\"365\" height=\"46\"></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td>今天是");
      out.print(showdate.getDate());
      out.write("</td>\r\n");
      out.write("      </tr>\r\n");
      out.write("    </table></td>\r\n");
      out.write("    <td width=\"84\" align=\"left\" valign=\"middle\"><table width=\"100%\"  border=\"0\">\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td><img src=\"images/top_home.gif\" width=\"13\" height=\"12\"><span class=\"style3\"><a onclick=\"this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.qichunren.com');return false;\" href=\"http://www.qichunren.com\" title=\"将本站设为你的首页\">设为首页</a></span>          </td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td><img src=\"images/top_gift.gif\" width=\"13\" height=\"12\"><span class=\"style3\"><a href=\"javascript:window.external.AddFavorite(location.href,document.title)\" title=\"将本站加入到你的收藏夹\" class=\"navbar\">加入收藏</a></span></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td><img src=\"images/top_mail.gif\" width=\"14\" height=\"12\"><span class=\"style3\"><a href=\"guestbook/guestbook_index.jsp\" target=\"_self\">留言建议</a></span></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td><img src=\"images/top_home.gif\" width=\"13\" height=\"12\"><span class=\"style3\"><a href=\"index.jsp\" target=\"_self\">回到首页</a></span></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("    </table>      \r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("<table width=\"72%\"  border=\"0\" align=\"center\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"6\" bgcolor=\"#000000\"></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write(" \r\n");
      out.write("<table width=\"72%\"  border=\"0\" align=\"center\">\r\n");
      out.write(" <tr bgcolor=\"00CCFF\" >\r\n");
      out.write("    <td>序号</td><td>书名</td><td>图书编号</td><td>分类</td><td>库存量</td>\r\n");
      out.write("  </tr>\r\n");

while(rs.next()){
String booktitle=rs.getString(2);
String bookid=rs.getString(3);
String booktype=rs.getString(4);
int quantity=rs.getInt(5);
id++;
if(color=="#CCCCCC"){color="#999999";}
else{color="#CCCCCC";}

      out.write(" \r\n");
      out.write("  <tr bgcolor=");
      out.print(color);
      out.write(">\r\n");
      out.write("  <td>");
      out.print(id);
      out.write("</td><td>");
      out.print(booktitle);
      out.write("</td><td>");
      out.print(bookid);
      out.write("</td><td>");
      out.print(booktype);
      out.write("</td><td>");
      out.print(quantity);
      out.write("</td>\r\n");
      out.write("   </tr>\r\n");
}
      out.write("\r\n");
      out.write("</table>\r\n");
      out.write("\r\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<title>JSP图书管理系统</title>\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write(".myname {color: #FF0000}\r\n");
      out.write(".style1 {\r\n");
      out.write("\tfont-size: 14px;\r\n");
      out.write("\tcolor: #FFFFFF;\r\n");
      out.write("}\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<table width=\"72%\"  border=\"0\" align=\"center\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td bgcolor=\"#99CCCC\"><div align=\"center\">\r\n");
      out.write("      <p class=\"style1\"><br>\r\n");
      out.write("        <a href=\"http://www.xawl.org/cms/\" target=\"_blank\">学校主站</a>-<a href=\"introduce.jsp\" target=\"_self\">图书馆介绍</a>-<a href=\"guestbook/guestbook_index.jsp\" target=\"_self\">留言建议</a>-<a href=\"admin/admin_login.jsp\" target=\"_self\">管理登录</a></p>\r\n");
      out.write("      <p>JSP版图书管理系统<br> \r\n");
      out.write("          程序设计:计算机系05级3班<span class=\"myname\">高向阳</span><br>\r\n");
      out.write("          </p>\r\n");
      out.write("    </div></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -