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

📄 index_jsp.java

📁 一个很不错的java实现的留言本程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
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.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/conn.jsp");
  }

  public java.util.List 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');

java.sql.Connection conn;
java.sql.Statement stmt;
java.sql.ResultSet rs;
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=jorwoobook";
String user="pade";
String password="pade";
conn=DriverManager.getConnection(url,user,password);
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);


      out.write('\r');
      out.write('\n');
      out.write('\r');
      out.write('\n');
 
/*
     巧悟留言板1.0版(JSP)                               
                                                         
     程序设计:Jorwoo                                     
                                                        
     QQ:513768                                         
     E-Mail:jorwoo@eyou.com                             
     网站:http://jorwoo.yeah.net       
*/	
String condition="select * from system";
rs=stmt.executeQuery(condition);
rs.next();

      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<title>");
      out.print(rs.getString("title"));
      out.write("</title>\r\n");
      out.write("<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write(".style1 {font-family: \"宋体\"}\r\n");
      out.write(".style2 {font-size: 9px}\r\n");
      out.write(".style3 {color: #9999CC; text-decoration: none; font-family: \"宋体\";}\r\n");
      out.write(".style4 {font-size: 9pt}\r\n");
      out.write(".style5 {color: #999999}\r\n");
      out.write(".style6 {font-family: \"宋体\"; color: #999999; }\r\n");
      out.write(".style7 {color: #FF0000}\r\n");
      out.write(".style8 {font-family: Tahoma}\r\n");
      out.write("a.rights:link {\r\n");
      out.write("\tCOLOR: #000000;\r\n");
      out.write("\tTEXT-DECORATION: none;\r\n");
      out.write("\t\r\n");
      out.write("}\r\n");
      out.write("a.rights:visited {\r\n");
      out.write("\tCOLOR: #000000;\r\n");
      out.write("\tTEXT-DECORATION: none;\r\n");
      out.write("\t\r\n");
      out.write("}\r\n");
      out.write("a.rights:hover {\r\n");
      out.write("\tCOLOR: #FF0000;  \r\n");
      out.write("\tTEXT-DECORATION: none;\r\n");
      out.write("\t\r\n");
      out.write("}\r\n");
      out.write(".style9 {\r\n");
      out.write("\tfont-size: 9pt;\r\n");
      out.write("\tcolor: #FF0000;\r\n");
      out.write("\tfont-weight: bold;\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 background=\"img/beijing.gif\" text=\"#000000\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n");
      out.write("<table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"tittle0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td width=\"389\" align=\"center\" valign=\"middle\"><img src=\"img/toplogo1.jpg\" width=\"389\" height=\"150\"></td>\r\n");
      out.write("    <td width=\"66\" background=\"img/toplogobg.jpg\">&nbsp;</td>\r\n");
      out.write("    <td width=\"195\"><img src=\"img/toplogo2.jpg\" width=\"203\" height=\"150\"></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("<table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"tittle1\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"26\" background=\"img/bg.gif\"><table width=\"100%\" height=\"15\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("      <tr align=\"center\">\r\n");
      out.write("        <td width=\"41%\" class=\"font0\"><span class=\"font0\">版主:</span><font color=\"#006699\">");
      out.print(rs.getString("adminname"));
      out.write("</font></td>\r\n");
      out.write("        <td width=\"59%\"><a href=\"add.jsp\" class=\"font0\">给我留言</a> <span class=\"font0\">│</span> <a href=\"login.jsp\" class=\"font0\">管理登录</a><font color=\"#000099\"> </font><span class=\"font0\">│</span> <span><a href=\"system.jsp\" class=\"font0\">系统设定</a></span><font color=\"#000099\"> </font><span class=\"font0\">│</span><font color=\"#000099\"> </font><a href=\"");
      out.print(rs.getString("web"));
      out.write("\"><span class=\"font0\">网站首页</span></a></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("    </table></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("<table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"40\" align=\"center\" valign=\"middle\"><table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("        <tr> \r\n");
      out.write("          <td width=\"25\" align=\"right\"><img src=\"img/fav_add.gif\" width=\"25\" height=\"25\"></td>\r\n");
      out.write("          <td valign=\"bottom\"> <p> \r\n");
      out.write("              <marquee  height=20 hspace=5 loop=100 scrollamount=2\r\n");
      out.write("      scrolldelay=10 width=100% on=\"left\" DIRECTI \r\n");
      out.write("      align=\"center\">\r\n");
      out.write("              <span class=\"style9\">");
      out.print(rs.getString("news"));
      out.write("\r\n");
      out.write("              </span>\r\n");
      out.write("              </marquee>\r\n");
      out.write("          </p></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("      </table></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("  ");
 

String condition2="select * from message order by id DESC";
rs=stmt.executeQuery(condition2);
int intPageSize; 
int intRowCount; 
int intPageCount; 
int intPage; 
String strPage;
int i;
intPageSize = 8;
strPage = request.getParameter("page");
if(strPage==null){
intPage = 1;
}
else
{
intPage = Integer.parseInt(strPage);
if(intPage<1){ intPage = 1;}
}
rs.last(); 
intRowCount = rs.getRow(); 
intPageCount =(intRowCount+intPageSize-1) / intPageSize;
if(intPage>intPageCount) intPage = intPageCount;

⌨️ 快捷键说明

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