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

📄 index.jsp

📁 1
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html; charset=gb2312"%>
<%@page import="
java.sql.*,
javax.sql.*,
javax.naming.*,
com.aheadedu.fen.bean.*,
com.aheadedu.fen.service.*"
%>
<%
		NewsService ns=new NewsService("jdbc/news");
		Connection con=ns.getCon();
		Statement stmt=con.createStatement();
		Statement stmt1=con.createStatement();
		//////////////////////////////////////////
		  String sql1="SELECT count(*) FROM news where ispub=1 order by newsid";
		  ResultSet rs0 = stmt1.executeQuery(sql1);
		  rs0.next();
		  int resultCount= rs0.getInt(1);
		  int pageresult=6;
		  if(resultCount<pageresult){
		  	pageresult=resultCount;
			}
		  int pageCount=0;
		  if(resultCount==0){
		  		pageCount=0;
		  }else{
		  if ((resultCount % pageresult) ==0){
		  	 pageCount = resultCount / pageresult;
		  }else{
		  	pageCount = resultCount / pageresult +1;
		  }
		  }
		  
		 // int page=0;
		 String pageInt= request.getParameter("pageActive");//获得访问页面的页码
		 //判断  假如 pageInt = null 我们就让pageInt =1
		 if (pageInt == null || pageInt.equals("")){
		 	pageInt = "1";
		 }
		 int pageActive = 0;
		 try{
		  pageActive=Integer.parseInt(pageInt);
		  }catch(Exception ex){
		  pageActive =1;
		  }
		  
		   //判断页码
		 if (pageActive <= 0){
		 	pageActive = 1;
		 }else if(pageActive>pageCount) {
		 		pageActive=pageCount;
		 	}
			 
		  int beginResult=0;
		  beginResult = (pageActive-1) * pageresult;

		
		//for 浏览

		ResultSet rs=stmt.executeQuery("select newsid,title,content from news where  ispub=1 order by pub_time desc limit "+beginResult+","+pageresult);
%>
<HTML>
<HEAD>
<TITLE>
<!--Your Company Name-->
Template
</TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<!--CharSet-->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<link rel="stylesheet" href="images/CSS.CSS" type="text/css">
<link rel="stylesheet" type="text/css" href="util_file/all.css" />
<script language="javascript" src="admin/login.js"></script>
<script language="javascript" src="util_file/ctrlimage.js"></script>
<style type="text/css">
<!--
-->
</style>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function window_onload() {
<!--Page.OnLoad-->
}

//-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR=#0085B0 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" LANGUAGE=javascript onLoad="return window_onload()">
<!--Counter-->
<!--Something Here-->
<table width="778" border="0" cellspacing="0" cellpadding="0" height="320" align="center">
  <tr> 
    <td colspan="4" height="30"><img src="images/index_top1.gif" width="778" height="30"></td>
  </tr>
  <tr> 
    <td height="250" width="128"><img src="images/index_top2.gif" width="128" height="250"></td>
    <td height="250" width="380" background="images/index_top3.gif">
      <table border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td> 
            <div align="center"></div>
            <div align="center"><font color="#000000"><b><font size="5">
<!--Your Company Name-->
胡玉玺JSP新闻系统 

          </font></b></font></div>          </td>
        </tr>
        <tr> 
          <td> 
            <div align="center"><font size="4" color="#000000">
<!--Your Company Name.English-->
www.javaif.com
</font></div>          </td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
        </tr>
      </table>    </td>
    <td height="250" width="220" background="images/01.gif"><img src="images/index_pic.gif" width="220" height="250"></td>
    <td height="250" width="50"><img src="images/index_top4.gif" width="50" height="250"></td>
  </tr>
  <tr> 
    <td colspan="4" height="40"><img src="images/index_top5.gif" width="778" height="40"></td>
  </tr>
</table>
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center" background="images/index_bg.gif">
  <tr> 
    <td width="230" valign="top"> 
      <table width="230" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td valign="top"> <br>




            <table width="230" border="0" cellspacing="0" cellpadding="0" height="46">
              <tr> 
                <td> 
                  <table width="210" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="100%"><b>
					  <a href="#">

<!--Language-->
<!--Something Here-->

					  </a></b> </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>




            <table width="230" border="0" cellspacing="0" cellpadding="0" height="46" background="images/index_lm.gif">
              <tr> 
                <td> 
                  <table width="210" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="90">&nbsp;</td>
                      <td width="120"><b>
					  <a href="#">
					  首页					  </a></b> </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>




<!--Button1.Content.Begin-->
            <table width="230" border="0" cellspacing="0" cellpadding="0" height="46" background="images/index_lm.gif">
              <tr> 
                <td> 
                  <table width="210" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="90">&nbsp;</td>
                      <td width="120"><b>
<!--Button1.Link-->
<a href="/mynews/admin/message.jsp">
<!--Button1-->
给我留言					  </a></b> </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
<!--Button1.Content.End-->



<!--Button2.Content.Begin-->
            <table width="230" border="0" cellspacing="0" cellpadding="0" height="46" background="images/index_lm.gif">
              <tr> 
                <td> 
                  <table width="210" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="90">&nbsp;</td>
                      <td width="120"><b>
<!--Button2.Link-->
<a href="javascript:popSignFlow(1)">
<!--Button2-->
管理新闻
					  </a></b></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
<!--Button2.Content.End-->



<!--Button3.Content.Begin-->
            <table width="230" border="0" cellspacing="0" cellpadding="0" height="46" background="images/index_lm.gif">
              <tr> 
                <td> 
                  <table width="210" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="90">&nbsp;</td>
                      <td width="120"><b>
<!--Button3.Link-->
<a href="#">
<!--Button3-->
与我联系
					  <font size="2"> </font></a></b></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
<!--Button3.Content.End-->



<!--Button4.Content.Begin-->
            <table width="230" border="0" cellspacing="0" cellpadding="0" height="46">
              <tr> 
                <td> 
                  <table width="90" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="90">&nbsp;</td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
<!--Button4.Content.End-->



<!--Button5.Content.Begin-->
            <table width="230" border="0" cellspacing="0" cellpadding="0" height="44">
              <tr> 
                <td> 
                  <table width="210" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="90">&nbsp;</td>
                      <td width="120">&nbsp;</td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
<!--Button5.Content.End-->



<!--Button6.Content.Begin-->

⌨️ 快捷键说明

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