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

📄 list_jsp.java

📁 一个新闻查询系统 Jsp+MySql
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import news.*;
import news.database.*;
import news.news.*;
import news.util.*;
import news.admin.*;

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

  public String getServletInfo() {
    return "database handler";
  }

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(3);
    _jspx_dependants.add("/inc/incdb.jsp");
    _jspx_dependants.add("/inc/common.jsp");
    _jspx_dependants.add("/foot.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,
      			null, 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');
      out.write("<!--¿ªÊ¼µ¼Èëpackages-->\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<!--µ¼Èë½áÊø-->\r\n");

String title = "ÐÂÎŹÜÀíϵͳ";
String placebgcolor = "#EEEEEE";

String tablebgcolor = "#336699";
String trbgcolor = "#336699";
String tdbgcolor = "#FFFFFF";

String tablebgcolor2 = "#6699CC";
String trbgcolor2 = "#EEEEEE";
String trbgcolor3 = "#FFFFFF";
String tdbgcolor2 = "#6699CC";
String tdbgcolor3 = "#DDDDDD";
String tdbgcolor4 = "#EEEEEE";
String tablewidth = "96%";
String tablewidth2 = "94%";


      out.write("\r\n<HTML><HEAD><TITLE>");
      out.print(title);
      out.write("</TITLE>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\r\n<META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">\r\n<LINK href=\"css/css.css\" rel=stylesheet type=text/css>\r\n</HEAD>\r\n<BODY bgColor=#ffffff leftMargin=0 text=#000000 topMargin=0>\r\n<script Language=\"JavaScript\">\r\n<!--\r\nfunction isspacestring(mystring)\r\n{ var istring=mystring;\r\n  var temp,i,strlen;\r\n  temp=true;\r\n  strlen=istring.length;\r\n  for (i=0;i<strlen;i++)\r\n  {\r\n    if ((istring.substring(i,i+1)!=\" \")&(temp))\r\n     { temp=false;  }\r\n  }\r\n return temp;\r\n}\r\n\r\nfunction firstisspace(mystring)\r\n{ var istring=mystring;\r\n  var temp,i,strlen;\r\n  temp=false;\r\n    if (istring.substring(0,1)==\" \")\r\n     { temp=true;  }\r\n return temp;\r\n}\r\n\r\nfunction check_input(theForm)\r\n{\r\n\r\n   if ((theForm.content.value == \"\")|(firstisspace(theForm.content.value)))\r\n  {\r\n    alert(\"请输入查询的条件.不能以空格开头\");\r\n    theForm.content.focus();\r\n    return (false);\r\n  }\r\n\r\n  if ((theForm.content.value == \"\")|(isspacestring(theForm.content.value)))\r\n");
      out.write("  {\r\n    alert(\"请输入查询的条件.\");\r\n    theForm.content.focus();\r\n    return (false);\r\n  }\r\n}\r\n//-->\r\n</script>\r\n<CENTER>\r\n<TABLE border=0 cellPadding=0 cellSpacing=0 height=81 width=776>\r\n  <TBODY>\r\n  <TR>\r\n    <TD width=776>\r\n      <TABLE border=0 cellPadding=0 cellSpacing=0 width=\"100%\">\r\n        <TBODY>\r\n        <TR>\r\n          <TD background=\"img/index/b-banner.jpg\" height=\"83\" width=\"100%\"><IMG SRC=\"img/index/ban.jpg\" WIDTH=\"340\" HEIGHT=\"83\" BORDER=\"0\"></TD>\r\n\t\t\t\t</TR>\r\n        <TR>\r\n          <TD height=23>\r\n            <TABLE border=0 cellPadding=0 cellSpacing=0 class=font-12 \r\n            height=\"100%\" width=\"100%\" background=\"img/index/nav1.jpg\">\r\n              <TBODY>\r\n              <TR>\r\n                <TD align=middle width=50><A class=w href=\"index.jsp\">首   页</A></TD>\r\n                ");
	Vector listclass = new Vector();
								DispClass dispclass = new DispClass();
								listclass = dispclass.allClass();
								for(int i=0;i<listclass.size();i++) {
								IClass classinfo = (IClass)listclass.elementAt(i);	
      out.write("\r\n                <TD align=middle width=50><A class=w href=\"list.jsp?id=");
      out.print(classinfo.getID());
      out.write('"');
      out.write('>');
      out.print(classinfo.getName());
      out.write("</A></TD>\r\n\t\t\t\t\t\t\t\t");
}
      out.write("\r\n                </TR></TBODY></TABLE></TD>\r\n\t\t\t\t\t\t\t</TR>\r\n\t\t\t\t\t\t\t</TBODY>\r\n\t\t\t\t\t\t</TABLE>\r\n\t\t\t\t\t</TD>\r\n\t\t\t\t</TR>\r\n\t\t\t\t</TBODY>\r\n\t\t</TABLE>\r\n<TABLE border=0 cellPadding=0 cellSpacing=0 height=26 width=776>\r\n  <TBODY>\r\n  <TR>\r\n    <TD background=\"img/index/nav.jpg\" vAlign=center>\r\n      <TABLE align=center border=0 cellPadding=0 cellSpacing=0 \r\n      style=\"FONT-SIZE: 12px\" width=\"100%\">\r\n        <FORM action=\"search.jsp\" method=post name=form1 onsubmit=\"return check_input(this)\">\r\n        <TBODY>\r\n        <TR>\r\n          <TD align=middle vAlign=center width=170>\r\n            <SCRIPT language=JavaScript>\r\n  \t\t\t\t\ttoday=new Date();                                                                                      function initArray(){\r\n\t\t\t\t\t\tthis.length=initArray.arguments.length\r\n\t\t\t\t\t\tfor(var i=0;i<this.length;i++)\r\n\t\t\t\t\t\tthis[i+1]=initArray.arguments[i] }\r\n\t\t\t\t\t\tvar d=new initArray(\"<font color=RED>星期日</font>\",\"星期一\",\"星期二\",\"星期三\",\"星期四\",\"星期五\",\"<font color=GREEN>星期六</font></font>\"); document.write(today.getYear(),\"年\",today.getMonth()+1,\"月\",today.getDate(),\"日\",\" \",d[today.getDay()+1]);\r\n");
      out.write("   \t\t\t\t\t</SCRIPT>\r\n          </TD>\r\n          <TD align=middle width=322>&nbsp;</TD>\r\n          <TD align=middle width=284>本站搜索: <INPUT name=content size=16   \r\n            style=\"FONT-SIZE: 12px\"><INPUT name=Submit type=submit value=GO>   \r\n    </TD></TR></FORM></TBODY></TABLE></TD></TR></TBODY></TABLE>\r\n<TABLE border=0 cellPadding=0 cellSpacing=0 width=776>\r\n  <TBODY>\r\n  <TR>\r\n    <TD bgColor=#999999>&nbsp;</TD>\r\n    <TD width=180><IMG border=0 height=22 src=\"img/index/code-top.gif\" \r\n      width=180></TD></TR></TBODY></TABLE>\r\n<TABLE border=0 cellPadding=3 cellSpacing=0 width=776>\r\n  <TBODY>\r\n  <TR bgColor=#996633>\r\n    <TD colSpan=4 height=5></TD></TR>\r\n  <TR>\r\n    <TD align=middle bgColor=#eeeeee rowSpan=2 vAlign=top width=150>\r\n       \r\n      <TABLE border=0 cellPadding=0 cellSpacing=0 width=\"100%\">\r\n        <TBODY>\r\n        <TR>\r\n          <TD width=30><IMG height=22 src=\"img/index/l-1.gif\" \r\n          width=30></TD>\r\n          <TD background=\"img/index/l-2.gif\">撰稿人排行</TD>\r\n          <TD width=30><IMG height=22 src=\"img/index/l-3.gif\" \r\n");
      out.write("          width=45></TD></TR></TBODY></TABLE>\r\n      <TABLE bgColor=#000000 border=0 cellPadding=5 cellSpacing=1 \r\n        width=\"100%\"><TBODY>\r\n        <TR>\r\n          <TD bgColor=#eeeeee>\r\n\t\t\t\t\t");
	Vector listmaster = new Vector();
							DispMaster dispmaster = new DispMaster();
							listmaster = dispmaster.allMaster();
							for(int i=0;i<listmaster.size();i++) {
							Master masterinfo = (Master)listmaster.elementAt(i);
							if(i>5){continue;}
							
      out.write("\r\n\t\t\t\t\t");
      out.print(i+1);
      out.write(".&nbsp;&nbsp;");
      out.print(masterinfo.getUserName());
      out.write("&nbsp;&nbsp;&nbsp;\r\n\t\t\t\t共");
      out.print(masterinfo.getTotal());
      out.write("篇新闻<BR>");
}
      out.write("\r\n\t\t\t\t\t</TD></TR></TBODY></TABLE></TD>\r\n    <TD align=middle rowSpan=2 vAlign=top>\r\n      <TABLE border=0 cellPadding=3 width=\"100%\">\r\n        <TBODY>\r\n\t\t\t\t\t");
int id =(null==request.getParameter("id")?1:(Integer.parseInt(request.getParameter("id"))));

					//DispClass dispclass = new DispClass();
					dispclass.setID(id);
					IClass iclass = dispclass.idToClass();
      out.write("\r\n\t\t\t\t\t<TR><TD width='50%' bgColor=#eeeeee><FONT COLOR=\"#990000\">");
      out.print(iclass.getName());
      out.write("</FONT></TD></TR>\r\n\t\t\t\t\t");

					Vector classnews = new Vector();
					DispNews dispnews = new DispNews();
					dispnews.setRootID(id);
					classnews = dispnews.rootidToNews();
					if(classnews.size()==0){
      out.write("\r\n\t\t\t\t\t\t<TR><TD width='50%'>暂时还没有新闻</TD></TR>\r\n\t\t\t\t\t\t");
}//结束if;
					for(int j=0;j<classnews.size();j++) {
					News clanews = (News)classnews.elementAt(j);	
					if(j>19){continue;}	
      out.write("\r\n        <TR>\r\n          <TD width=\"50%\">\r\n\t\t\t\t\t<A href=\"news.jsp?id=");
      out.print(clanews.getID());
      out.write("\" target=_blank   \r\n\t\t\t\t\t\t\ttitle=");
      out.print(clanews.getTopic());
      out.write('>');
      out.print(clanews.getTopic());
      out.write("</A>\r\n          </TD></TR>");
}
      out.write("</TBODY></TABLE>\r\n\t\t\t</TD>\r\n    <TD align=middle bgColor=#996633 rowSpan=2 vAlign=top width=180>\r\n      <TABLE border=0 cellPadding=0 cellSpacing=0 width=170>\r\n        <TBODY>\r\n        <TR>\r\n          <TD><IMG height=20 src=\"img/index/2002.gif\" width=170></TD></TR>\r\n        <TR>\r\n          <TD bgColor=#333333>\r\n            <TABLE border=0 cellPadding=3 width=\"100%\">\r\n              <TBODY>\r\n              <TR>\r\n                <TD>\r\n\t\t\t\t\t\t\t\t");
	Vector allnews = new Vector();
								//DispNews dispnews = new DispNews();
								allnews = dispnews.allNews();
								int maxhit=dispnews.maxHit();
      out.write("\r\n\t\t\t\t\t\t");
  for(int j=0;j<allnews.size();j++) {
								News allnewsinfo = (News)allnews.elementAt(j);
								if(j>9){continue;}
      out.write("\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<FONT color=#ffffff>■ <A class=w \r\n                  href=\"news.jsp?id=");
      out.print(allnewsinfo.getID());
      out.write("\" \r\n                  target=_blank title=\"");
      out.print(allnewsinfo.getTopic());
      out.write('"');
      out.write('>');
      out.print(allnewsinfo.getTopic());
      out.write("\r\n\t\t\t\t\t\t\t\t\t</A></FONT><BR><FONT color=#ffffff>\r\n\t\t\t\t\t\t\t\t\t");
}
      out.write("\r\n\t\t\t\t\t\t\t\t\t</FONT><BR></TD></TR></TBODY></TABLE></TD></TR>\r\n        <TR>\r\n          <TD><IMG height=20 src=\"img/index/2001.gif\" \r\n        width=170></TD></TR></TBODY></TABLE>\r\n    </TD></TR></TBODY></TABLE>\r\n<TABLE bgColor=#eeeeee border=0 height=108 width=776>\r\n  <TBODY>\r\n  <TR>\r\n    <TD align=middle> \r\n\t\t");
      out.write("<BR>½¨ÒéÄúʹÓà IE4.0ºÍNETSCAPE5.0ÒÔÉϰ汾£¬800X600·Ö±æÂÊä¯ÀÀ<BR>±¾Õ¾ÓòÃû:  <A href=\"http://www.pcccp.com\">www.pcccp.com</A>  <A HREF=\"admin/index.jsp\">¹ÜÀíÈë¿Ú</A>");
      out.write("\r\n\t\t</TD></TR></TBODY></TABLE></CENTER></BODY></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 + -