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

📄 index_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.*;
import java.sql.*;

public final class index_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(4);
    _jspx_dependants.add("/ch.jsp");
    _jspx_dependants.add("/top.jsp");
    _jspx_dependants.add("/searchbook.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');

request.setCharacterEncoding("gb2312");
response.setContentType("text/html;charset=gb2312");//½â¾öÖÐÎÄÂÒÂë

      out.write('\r');
      out.write('\n');
      conndb.DbConnBean indexdb = null;
      synchronized (_jspx_page_context) {
        indexdb = (conndb.DbConnBean) _jspx_page_context.getAttribute("indexdb", PageContext.PAGE_SCOPE);
        if (indexdb == null){
          indexdb = new conndb.DbConnBean();
          _jspx_page_context.setAttribute("indexdb", indexdb, PageContext.PAGE_SCOPE);
        }
      }
      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("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("-->\r\n");
      out.write("</style>\r\n");
      out.write("\r\n");
      out.write("</head>\r\n");
      out.write("\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("\r\n");
      out.write("      <table width=\"72%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\r\n");
      out.write("        <tr>\r\n");
      out.write("          <td width=\"10%\" align=\"center\" bgcolor=\"#EFEFEF\">\r\n");
      out.write("<img src=\"images/announce.gif\" width=\"20\" height=\"16\"></td>\r\n");
      out.write("          <td width=\"90%\" bgcolor=\"#EFEFEF\"><marquee scrollAmount=3> \r\n");

Connection conn=indexdb.getConn();
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from notice order by id desc");	  

	  rs.next();//将数据库中的游标向下移动一行,因为首先的时候游戏是位于首行之前的一行
	  String notice=rs.getString(2);
           String ntime=rs.getString(3).substring(0,11);
	  
      out.write(" \r\n");
      out.write("\t  ");
      out.print(notice);
      out.write('-');
      out.print(ntime);
      out.write("</marquee>\r\n");
      out.write("\t  </td>\r\n");
      out.write("        </tr>  \r\n");
      out.write("        <tr>\r\n");
      out.write("          <td height=\"300\" colspan=\"2\" bgcolor=\"#99CC99\" background=\"images/50b46e21754d249f3328cb0a855a8cc9.jpg\" valign=\"top\">欢迎师生们的光临!在这里你可以查询学校图书馆里的图书信息,愿你能找到你想看的图书!<br>\r\n");
      out.write("对图书馆有什么建议,请给我们<a href=\"guestbook/guestbook_index.jsp\"><b>提出来</b></a>,我们会认真处理你的留言.</td>\r\n");
      out.write("        </tr>\r\n");
      out.write("        <tr>\r\n");
      out.write("     ");
      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("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write(".tip {font-size: 11px}\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write(" <table width=\"72%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\r\n");
      out.write("        <tr>\r\n");
      out.write("<td width=\"120\" height=\"30\" bgcolor=\"#EFEFEF\"><img src=\"images/search.gif\" width=\"120\" height=\"26\"></td>\r\n");
      out.write(" <td width=\"455\" bgcolor=\"#EFEFEF\">\r\n");
      out.write("<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("  <form name=\"form1\" action=\"searchbook_post.jsp\" method=\"post\">\r\n");
      out.write("      <td width=\"80%\" height=\"25\" nowrap bgcolor=\"#EFEFEF\">\r\n");
      out.write("          <input name=\"keyword\" size=\"30\" value='关键字' onFocus='this.select();'> \r\n");
      out.write("          <select name=\"type\">\r\n");
      out.write("          <option value=\"booktitle\">图书标题</option>\t  \r\n");
      out.write("\t  <option value=\"bookid\">图书编号</option>\r\n");
      out.write("\t \r\n");
      out.write("          </select>\r\n");
      out.write("          <input name=\"Submit\" src=\"images/d_search.gif\" type=\"image\" width=\"60\" height=\"20\" align=\"absmiddle\" border=\"0\"></td>\r\n");
      out.write("      <td width=\"20%\" nowrap bgcolor=\"#EFEFEF\"></td>\r\n");
      out.write("   </form>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table></td></tr></table>\r\n");
      out.write("\r\n");
      out.write(" <div align=\"right\" class=\"tip\">\r\n");
      out.write("   <div align=\"center\">TIP:关键字为空,则返回所有图书信息 </div>\r\n");
      out.write(" </div>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
      out.write("        </tr>\r\n");
      out.write("        <tr>\r\n");
      out.write("          <td height=\"230\" colspan=\"2\"></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("\r\n");
      out.write("\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("</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 + -