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

📄 search_jsp.java

📁 用jsp实现在线留言!采用MVC三层架构!
💻 JAVA
字号:
package org.apache.jsp;

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

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

  private static java.util.List _jspx_dependants;

  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,
      			"err.jsp", 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("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<META NAME=\"keywords\" CONTENT=\"溢洋 溢洋论坛 xyworker@163.com java forum jsp forum\">\r\n");
      out.write("<META NAME=\"description\" CONTENT=\"溢洋 溢洋论坛 xyworker@163.com java forum jsp forum\">\r\n");
      out.write("<link rel='stylesheet' type='text/css' href='inc/FORUM.CSS'>\r\n");
      out.write("<script language=\"JavaScript\"> \r\n");
      out.write("function Popup(url, window_name, window_width, window_height) \r\n");
      out.write("{ settings= \r\n");
      out.write("\"toolbar=no,location=no,directories=no,\"+ \r\n");
      out.write("\"status=no,menubar=no,scrollbars=yes,\"+ \r\n");
      out.write("\"resizable=yes,width=\"+window_width+\",height=\"+window_height; \r\n");
      out.write("\r\n");
      out.write("NewWindow=window.open(url,window_name,settings); }\r\n");
      out.write("\r\n");
      out.write("function icon(theicon) { \r\n");
      out.write("document.input.message.value += \" \"+theicon; \r\n");
      out.write("document.input.message.focus(); \r\n");
      out.write("} \r\n");
      out.write("</script>\r\n");
      out.write("\r\n");
      out.write("<title>溢洋论坛</title>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("</head>\r\n");
      out.write("<body text=\"#0000ff\" align=\"center\"> \r\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "inc/public.jsp", out, true);
      out.write("\r\n");
      out.write("<table width=\"760\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\r\n");
      out.write("\r\n");
      out.write("<tr>\r\n");
      out.write("    <td bgcolor=\"#ffffff\"  width=\"501\"> <a href=\"default1.jsp\"><br>\r\n");
      out.write("      首页</a>&gt;&gt;<a href=\"index.jsp\">溢洋论坛</a>&gt;&gt;文章搜索</td>\r\n");
      out.write("    <td bgcolor=\"#ffffff\" class=\"post\" align=\"right\" width=\"230\"> </td>\r\n");
      out.write("  </tr></table>\r\n");
      out.write("\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"754\" align=\"center\"> \r\n");
      out.write("<form method=\"post\" action=\"article.jsp\"> \r\n");
      out.write("<tr><td bgcolor=\"#009ACE\"> \r\n");
      out.write(" \r\n");
      out.write("      <table border=\"0\" cellspacing=\"1\" cellpadding=\"6\" width=\"100%\">\r\n");
      out.write("        <tr bgcolor=\"#9CCFFF\"> \r\n");
      out.write("          <td colspan=\"2\">文章搜索</td> \r\n");
      out.write("</tr> \r\n");
      out.write(" \r\n");
      out.write("        <tr bgcolor=\"#F7FBFF\"> \r\n");
      out.write("          <td width=\"22%\">关 键 字:</td> \r\n");
      out.write("          <td> \r\n");
      out.write("            <input type=\"text\" name=\"key\" size=\"30\" maxlength=\"40\" /></td> \r\n");
      out.write("</tr> \r\n");
      out.write(" \r\n");
      out.write("        <tr bgcolor=\"#F7FBFF\"> \r\n");
      out.write("          <td width=\"22%\">搜索用户:</td> \r\n");
      out.write("          <td> \r\n");
      out.write("            <input type=\"text\" name=\"user\" size=\"30\" maxlength=\"40\" /></td> \r\n");
      out.write("</tr> \r\n");
      out.write(" \r\n");
      out.write("        <tr bgcolor=\"#F7FBFF\"> \r\n");
      out.write("          <td width=\"22%\">搜索论坛:</td> \r\n");
      out.write("          <td> \r\n");
      out.write("            <select name=\"board\"> \r\n");
      out.write("<option value=\"all\">所有</option>\r\n");
      yy.jdbc yy = null;
      synchronized (_jspx_page_context) {
        yy = (yy.jdbc) _jspx_page_context.getAttribute("yy", PageContext.PAGE_SCOPE);
        if (yy == null){
          yy = new yy.jdbc();
          _jspx_page_context.setAttribute("yy", yy, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');

 Connection con=yy.getConn();
 Statement  stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
 ResultSet rs=null;
 String sql="select 论坛id,论坛名称 from 论坛栏目";
 rs=stmt.executeQuery(sql);
 while (rs.next())
 { 

  out.println("<option value="+rs.getString("论坛id")+">"+rs.getString("论坛名称")+"</option>");
 }

      out.write("\r\n");
      out.write("\r\n");
      out.write("</select></td>\r\n");
      out.write("</tr>\r\n");
      out.write("\r\n");
      out.write("        <tr bgcolor=\"#F7FBFF\"> \r\n");
      out.write("          <td width=\"22%\">搜索时间:</td>\r\n");
      out.write("          <td> \r\n");
      out.write("            <select name=\"time\" size=\"1\">\r\n");
      out.write("<option value=\"1\">最近一天</option>\r\n");
      out.write("<option value=\"5\">最近5天</option>\r\n");
      out.write("<option value=\"10\">最近10天</option>\r\n");
      out.write("<option value=\"30\">最近30天</option>\r\n");
      out.write("<option value=\"365\">最近1年</option>\r\n");
      out.write("<option value=\"0\" selected>所有时间</option>\r\n");
      out.write("</select></td>\r\n");
      out.write("</tr>\r\n");
      out.write("\r\n");
      out.write("        <tr bgcolor=\"#F7FBFF\"> \r\n");
      out.write("          <td width=\"22%\">搜索范围:</td>\r\n");
      out.write("          <td class=\"tablerow\"> \r\n");
      out.write("            <input type=\"radio\" name=\"area\" value=\"content\">内容 <input type=\"radio\" name=\"area\" value=\"title\">标题 <input type=\"radio\" name=\"area\" value=\"both\" checked>两者都有</td>   \r\n");
      out.write("</tr>   \r\n");
      out.write("   \r\n");
      out.write("</table>   \r\n");
      out.write("</td></tr></table>   \r\n");
      out.write("<center><input type=\"submit\" name=\"searchsubmit\" value=\"文章搜索\" /></center>   \r\n");
      out.write("</form>   \r\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "inc/jumpboard.jsp", out, true);
      out.write("   \r\n");
      out.write("</body></html>    \r\n");
      out.write("\r\n");
      out.write("<html><script language=\"JavaScript\"></script></html>");
    } 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 + -