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

📄 index.jsp

📁 经典的“企业内部管理信息系统”JSP源代码
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page language="java" import="java.sql.*"%>
<%@ page language="java" import="java.util.*"%>
<%@ page language="java" import="java.text.*"%>
<jsp:useBean id="sqlbean" scope="page" class="news.sql_data"/>
<HTML><HEAD><TITLE>企业内部管理信息平台</TITLE>

<link rel="stylesheet" href="newstyle.css" type="text/css">

<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<CENTER><jsp:include page="header.jsp"/>
<TABLE cellSpacing=0 cellPadding=0 width=780>
  <TBODY>
  <TR>
    <TD width="159" vAlign=top><TABLE cellSpacing=0 cellPadding=0 width="97%" border=0>
        <TBODY>
<%String title;
  SimpleDateFormat sdf =new SimpleDateFormat( "MM-dd");
 String sql = "Select count(*) as newsall FROM news";
 ResultSet RS = sqlbean.executeQuery(sql);
  RS.first();
 String newsall=RS.getString("newsall");
 RS.close();
 //得到今天的日期
  java.util.Date  now = new java.util.Date();
DateFormat df =  DateFormat.getDateInstance();
String s =  df.format(now);
//完成
sql = "Select count(*) as todayall FROM news where datediff(hour,d,getdate())<24";
RS = sqlbean.executeQuery(sql);
 RS.first();
  String todayall=RS.getString("todayall");
 RS.close();
 sql = "Select sum(hit) as allhit FROM news";
 RS = sqlbean.executeQuery(sql);
  RS.first();
  String allhit=RS.getString("allhit");
 RS.close();%>
        <TR>
          <TD vAlign=top><br><br>		  
		   <TABLE width="99%" border=0 align=center cellPadding=2 cellSpacing=0 class="table3">
              <TR>
                <TD><img src="images/tongji.gif" width="140" height="41"></TD>
              </TR>
              <TR> 
                <TD><img src="images/jt.gif" width="17" height="19">共有信息:<font color="#000000"><strong><%=newsall%></strong></font>条 </TD>
              </TR>
              <TR> 
                <TD><img src="images/jt.gif" width="17" height="19">今日更新:<font color="#000000"><strong><%=todayall%></strong></font>条</TD>
              </TR>
              <TR>
                <TD><img src="images/jt.gif" width="17" height="19">总共浏览:<font color="#000000"><strong><%=allhit%></strong>次</font></TD>
              </TR>
            </TABLE>
            </TD></TR>
        </TBODY></TABLE></td>
    <TD width="619" vAlign=top><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><br><br><img src="images/ad.jpg" width="610" height="44"></td>
      </tr>
    </table></TD>
  </TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=780>
  <TBODY>
  <TR>
    <TD vAlign=top width=168>
      <TABLE style="BORDER-COLLAPSE: collapse"  height=15 
      cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD align="center" class="unnamed1" >-=热点关注=-</TD>
          <TD>
            <DIV align=right></DIV></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%">
        <TBODY>
        <TR>
          <TD vAlign=center><TABLE style="BORDER-COLLAPSE: collapse" 
             cellSpacing=0 cellPadding=0 width=154 
            border=0>
              <TBODY>
              <TR>
                <TD width=10 height=36></TD>
                <TD vAlign=top width=134>
<% sql = "Select top 10 id,title,hit  FROM news order by hit desc";
 RS = sqlbean.executeQuery(sql);
while (RS.next()){%>
<img src=images/ico1.gif><A href='show.jsp?id=<%=RS.getString("id")%>' title="<%=RS.getString("title")%>" class="TableLink"><%title=RS.getString("title");
if (title.length()>9){
	title=title.substring(0,8);
	out.println(title+"...");}else{
out.println(title);}
%></a><FONT color=#999999><%=RS.getString("hit")%></font><BR>
<%}
RS.close();%></TD>
                <TD width=10></TD>
              </TR></TBODY></TABLE></TD>
        </TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%">
        <TBODY>
          <TR>
            <TD vAlign=center><TABLE   cellSpacing=0 cellPadding=0 width=154   border=0>
                <TBODY>
                  <TR>
                    <TD></TD>
                    <TD align="center" vAlign=top class="unnamed1">-=最新加入=-</TD>
                    <TD></TD>
                  </TR>
                  <TR>
                    <TD width=10 height=36></TD>
                    <TD vAlign=top width=134>
                      <% sql = "Select top 10 id,title,hit  FROM news order by id desc";
 RS = sqlbean.executeQuery(sql);
while (RS.next()){%>
                      <img src=images/ico1.gif><A href='show.jsp?id=<%=RS.getString("id")%>' title="<%=RS.getString("title")%>" class="TableLink"><%
					  title=RS.getString("title");
					  if (title.length()>9){
	title=title.substring(0,8);
	out.println(title+"...");}else{
out.println(title);}
					  %></a> <FONT color=#999999><%=RS.getString("hit")%></font><BR>
                      <%}
RS.close();%></TD>
                    <TD width=10></TD>
                  </TR>
                </TBODY>
            </TABLE></TD>
          </TR>
        </TBODY>
      </TABLE></TD>
    <TD width="610" valign="top">
      <TABLE style="BORDER-COLLAPSE: collapse"  cellSpacing=0 
      cellPadding=0 width=610 border=0>
        <TBODY><tr><td colspan="4"><TABLE style="BORDER-COLLAPSE: collapse"  cellSpacing=0 
      cellPadding=0 width=610 border=0>
        <TBODY>
        <TR>
          <TD width="309"><TABLE style="BORDER-COLLAPSE: collapse"  
            cellSpacing=0 cellPadding=3 width=95% border=0>
            <TBODY>
              <% ResultSet RS_root = sqlbean.executeQuery("select top 4 class from class where parentclass='0' order by id");
RS_root.first();
sql = "Select top 8 *  FROM news where parentclass='"+RS_root.getString("class")+"' order by id desc";
 RS = sqlbean.executeQuery(sql);
 
 while (RS.next()){%>
              <tr>
                <TD width=16><IMG height=12 src="images/sword_org.gif" 
                  width=12 border=0></TD>
                <td style="LINE-HEIGHT: 150%; font-size: 9pt;"> [<A href='list.jsp?sortid=<%=RS.getString("class")%>&rootid=<%=RS.getString("parentclass")%>'><%=RS.getString("class")%></a>]<A href='show.jsp?id=<%=RS.getString("id")%>' title="<%=RS.getString("title")%>" class="TableLink"><u>
                  <%title=RS.getString("title");

if (title.length()>12){
	title=title.substring(0,11);
	out.println(title+"...");}else{
out.println(title);}%>
                </u></a><FONT color=#999999><%=sdf.format(RS.getDate("d"))%></FONT ></td>
              </tr>
              <%}
RS.close();%>
              <TR>
                <TD width=16 height=10></TD>
                <TD width=237 height=10></TD>
              </TR>
            </TBODY>
          </TABLE>             </TD>
          <TD width="301" valign="top"><TABLE style="BORDER-COLLAPSE: collapse"  
            cellSpacing=0 cellPadding=3 width=95% border=0>
            <TBODY>
              <%RS_root.next();
			 sql = "Select top 8 *  FROM news where parentclass='"+RS_root.getString("class")+"' order by id desc";
 RS = sqlbean.executeQuery(sql);

while (RS.next()){%>
              <tr>
                <TD width=16><IMG height=12 src="images/sword_org.gif" 
                  width=12 border=0></TD>
                <td style="LINE-HEIGHT: 150%; font-size: 9pt;"> [<A href='list.jsp?sortid=<%=RS.getString("class")%>&rootid=<%=RS.getString("parentclass")%>'><%=RS.getString("class")%></a>]<A href='show.jsp?id=<%=RS.getString("id")%>' title="<%=RS.getString("title")%>" class="TableLink"><u>
                  <%title=RS.getString("title");

if (title.length()>12){
	title=title.substring(0,11);
	out.println(title+"...");}else{
out.println(title);}%>
                </u></a><FONT color=#999999><%=sdf.format(RS.getDate("d"))%></FONT ></td>
              </tr>
              <%}
RS.close();%>
              <TR>
                <TD width=16 height=10></TD>
                <TD width=237 
      height=10></TD>
              </TR>
            </TBODY>
          </TABLE></TD>
        </TR></TBODY></TABLE>
              <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td colspan="2"><img src="images/ad2.jpg" width="610" height="67"></td>
                </tr>
                <tr>
                  <td width="51%" valign="top"><TABLE style="BORDER-COLLAPSE: collapse"  
            cellSpacing=0 cellPadding=3 width=95% border=0>
                    <TBODY>
                      <%RS_root.next();
			 sql = "Select top 8 *  FROM news where parentclass='"+RS_root.getString("class")+"' order by id desc";
 RS = sqlbean.executeQuery(sql);

while (RS.next()){%>
                      <tr>
                        <TD width=16><IMG height=12 src="images/sword_org.gif" 
                  width=12 border=0></TD>
                        <td style="LINE-HEIGHT: 150%; font-size: 9pt;"> [<A href='list.jsp?sortid=<%=RS.getString("class")%>&rootid=<%=RS.getString("parentclass")%>'><%=RS.getString("class")%></a>]<A href='show.jsp?id=<%=RS.getString("id")%>' title="<%=RS.getString("title")%>" class="TableLink"><u>
                          <%title=RS.getString("title");

if (title.length()>12){
	title=title.substring(0,11);
	out.println(title+"...");}else{
out.println(title);}%>
                        </u></a><FONT color=#999999><%=sdf.format(RS.getDate("d"))%></FONT ></td>
                      </tr>
                      <%}
RS.close();%>
                      <TR>
                        <TD width=16 height=10></TD>
                        <TD width=237 
      height=10></TD>
                      </TR>
                    </TBODY>
                  </TABLE></td>
                  <td width="49%" valign="top"><TABLE style="BORDER-COLLAPSE: collapse"  
            cellSpacing=0 cellPadding=3 width=95% border=0>
                    <TBODY>
                      <%
			 RS_root.next();
			 sql = "Select top 8 *  FROM news where parentclass='"+RS_root.getString("class")+"' order by id desc";
 RS = sqlbean.executeQuery(sql);
 //java.util.Date xx=rs.getDate(1);
 // java.text.DateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd");  
  //String s = df.format(xx);
RS_root.close();
while (RS.next()){%>
                      <tr>
                        <TD width=16><IMG height=12 src="images/sword_org.gif" 
                  width=12 border=0></TD>
                        <td style="LINE-HEIGHT: 150%; font-size: 9pt;"> [<A href='list.jsp?sortid=<%=RS.getString("class")%>&rootid=<%=RS.getString("parentclass")%>'><%=RS.getString("class")%></a>]<A href='show.jsp?id=<%=RS.getString("id")%>' title="<%=RS.getString("title")%>" class="TableLink"><u>
                          <%title=RS.getString("title");

if (title.length()>12){
	title=title.substring(0,11);
	out.println(title+"...");}else{
out.println(title);}%>
                        </u></a><FONT color=#999999><%=sdf.format(RS.getDate("d"))%></FONT ></td>
                      </tr>
                      <%}
RS.close();%>
                      <TR>
                        <TD width=16 height=10></TD>
                        <TD width=237 
      height=10></TD>
                      </TR>
                    </TBODY>
                  </TABLE></td>
                </tr>
              </table></td></tr>
  </TBODY></TABLE></TD></TR></TBODY></TABLE>
  <jsp:include page="bottom.jsp"/>

</CENTER>
</BODY></HTML>

⌨️ 快捷键说明

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