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

📄 index_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 index_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><script language=\"JavaScript\"></script></html>\r\n");
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<link rel='stylesheet' type='text/css' href='inc/FORUM.CSS'>\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("<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>\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"99%\" align=\"center\">\r\n");
      out.write("  <tr><td > \r\n");
      out.write(" ");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "inc/public.jsp", out, true);
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t\t<tr>\r\n");
      out.write("          <td width=\"734\" class=\"tablerow\" colspan=\"7\"  height=\"16\">\r\n");
      out.write("            <table border=\"0\" cellspacing=\"0\" width=\"100%\" cellpadding=\"0\">\r\n");
      out.write("              <tr>\r\n");
      out.write("                <td width=\"12%\"><font color=\"#333399\"><b><img src=\"image/gb.gif\" width=\"21\" height=\"14\">论坛公告:</b></font></td>\r\n");
      out.write("                <td width=\"88%\"> <marquee width=\"648\" height=\"12\" direction=\"left\">\r\n");
      out.write("\r\n");
      out.write("       ");
      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  rs=null;
        String sql="select 公告标题,公告内容,公告时间 from 公告 order by 公告id desc";
		String Notice="";
		int i=0;
		rs=stmt.executeQuery(sql);
		//rs.last();
		//if (rs.getRow()>0)
		//{
		 while ((rs.next())&&(i<5))
			{
		  String Time=rs.getString("公告时间");
		  Time=Time.substring(5,16);

		  Notice="<B>"+rs.getString("公告标题")+":</B><font color=black>"+rs.getString("公告内容")+"</font><font color=gray>&nbsp;"+Time+"</font>&nbsp;&nbsp;&nbsp;"+Notice;;
		  
		  i++;

		  
		  }
		
		out.println(Notice);




      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("                  </marquee> </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("        <tr bgcolor=\"#9CCFFF\">\r\n");
      out.write("          <td width=\"15\" height=\"14\">&nbsp;</td>\r\n");
      out.write("          <td width=\"247\" height=\"14\" bgcolor=\"#9CCFFF\">论坛列表</td>\r\n");
      out.write("          <td width=\"28\" align=\"center\" height=\"14\">新窗</td>\r\n");
      out.write("          <td width=\"58\" align=\"center\" height=\"14\">主题数量</td>\r\n");
      out.write("          <td width=\"57\" align=\"center\" height=\"14\">贴子数量 </td>\r\n");
      out.write("          <td width=\"170\" align=\"center\" height=\"14\">最后回复</td>\r\n");
      out.write("          <td width=\"63\" align=\"center\" height=\"14\">版主</td>\r\n");
      out.write("        </tr>\r\n");
      out.write(" \r\n");
      out.write("\t\t");
	

		sql="SELECT * FROM 论坛栏目";

		rs=stmt.executeQuery(sql);
		while (rs.next())
		{
		String Time_Str=rs.getString("最后发表时间");
                String Man_Str=rs.getString("最后发表人");
                String Forum_id=rs.getString("论坛id");
                String Forum_Mastor=rs.getString("版主姓名");
				
				if (Man_Str==null)
			       Man_Str="无";
				else
					Man_Str="<a href='member.jsp?member="+Man_Str+"'>"+Man_Str+"</a>";
				
				
				if ((Forum_Mastor==null)||(Forum_Mastor.equals("")))
                   Forum_Mastor="招骋中...";
				else
					Forum_Mastor="<a href=member.jsp?member="+Forum_Mastor+">"+Forum_Mastor+"</a>";
				
      out.write("\r\n");
      out.write("\t\t<tr bgcolor=\"#F7FBFF\">\r\n");
      out.write("          <td align=\"center\"  height=\"26\" width=\"15\"><img src=\"image/folder.gif\" width=\"13\" height=\"16\"></td>\r\n");
      out.write("          <td height=\"26\" width=\"247\" bgcolor=\"#F7FBFF\"><a href=\"board.jsp?fid=");
      out.print(Forum_id);
      out.write('"');
      out.write('>');
      out.write(' ');
      out.print(rs.getString("论坛名称"));
      out.write(" </a>\r\n");
      out.write("            <br />\r\n");
      out.write("          </td>\r\n");
      out.write("          <td align=\"center\" height=\"26\" width=\"28\">&nbsp;<a href=\"board.jsp?fid=");
      out.print(Forum_id);
      out.write("\" target=\"_blank\"><img border=\"0\" src=\"image/newwin.gif\" width=\"14\" height=\"11\"></a></td>\r\n");
      out.write("          <td align=\"center\" height=\"26\" width=\"58\">");
      out.print(rs.getString("主题数量"));
      out.write("</td>\r\n");
      out.write("          <td align=\"center\" height=\"26\" width=\"57\">");
      out.print(rs.getString("贴子数量"));
      out.write("</td>\r\n");
      out.write("          <td height=\"26\" width=\"170\">时间:");
      out.print(Time_Str.substring(0,16));
      out.write("<br>\r\n");
      out.write("            作者:");
      out.print(Man_Str);
      out.write("</a></td>\r\n");
      out.write("          <td align=\"center\" height=\"26\" width=\"63\">");
      out.print(Forum_Mastor);
      out.write("</td>\r\n");
      out.write("        </tr>\r\n");
      out.write("\r\n");
      out.write("\t\t");


                }
          
                
      out.write('\r');
      out.write('\n');
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "inc/showonline.jsp", out, true);
      out.write("\r\n");
      out.write("      </table>\r\n");
      out.write("</td></tr></table>\r\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "inc/jumpboard.jsp", out, true);
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<html><script language=\"JavaScript\"></script></html>\r\n");

  try {
		
		rs.close();
		stmt.close();
		con.close();
		}
		     catch (Exception ex) {
         }


    } 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 + -