<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.util.ArrayList"  %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>综合新闻</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK 
href="images/defult.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2900.3314" name=GENERATOR></HEAD>
<%
int i=0;
Class.forName("org.gjt.mm.mysql.Driver");
String url="jdbc:mysql://localhost:3306/meikuang?user=root&password=1234&useUnicode=true&characterEncoding=GB2312";

Connection conn= DriverManager.getConnection(url);  
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); 
String sql="select * from news order by id desc";
ResultSet rs=stmt.executeQuery(sql);

 %>
<BODY bgColor=#3399ff leftMargin=0 topMargin=0>
<%
String pg=request.getParameter("pg");
if(pg==null)
pg="1";
int tt;//记录总数
rs.last();
tt=rs.getRow();
rs.first();
int pagex;
if(tt%15==0)
{pagex=(tt/15);}
else
{pagex=(tt/15)+1;}//计算总页数
int pagey;//从用户那里得到的目标页
pagey=Integer.parseInt(pg);
if(pagey<1)
{
pagey=1;
}
if(pagey>pagex)
{
pagey=pagex;
}
//翻页开始,调整记录指针的位置
int n=(pagey-1)*15+1;
int a;
for(a=0;a<n-1;a++)
{
	if(!rs.isLast())
      rs.next();
}
//翻页结束
 %>
<DIV align=center>
<TABLE id=AutoNumber7 style="BORDER-COLLAPSE: collapse" borderColor=#111111 
cellPadding=0 width=778 border=0>
  <TBODY>
  <TR>
    <TD width="100%"><IMG height=111 src="images/logo21.gif" width=778 
      border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=778 border=0>
  <TBODY>
  <TR>
    <TD width=769>
      <TABLE cellSpacing=0 cellPadding=0 width=778 bgColor=#ffffff border=0>
        <TBODY>
        <TR>
          <TD></TD></TR>
        <TR>
          <TD class=title_001 align=middle background=images/navbar.gif 
          height=42>
            <TABLE style="FONT-SIZE: 10pt; BORDER-COLLAPSE: collapse" height=30 
            cellPadding=0 width=778 border=0>
              <TBODY>
              <TR>
                <TD vAlign=top background="" colSpan=2>
              <TR>
                <TD style="BORDER-BOTTOM: #c0c0c0 1px solid" width=23>　</TD>
                <TD style="BORDER-BOTTOM: #c0c0c0 1px solid" width=755>当前位置：<a href="index.jsp">首页</a>                  &gt;&gt;<font color="#ff0000">综合新闻 ：：                  </font><a href="allNews.do?classes=1">领导讲话</a>                  || <a href="allNews.do?classes=2">检查动态</a>                  || <a href="allNews.do?classes=3">行业动态</a>                  || <a href="allNews.do?classes=4">安全评估</a>                  || <a href="allNews.do?classes=5">伤亡事故</a></TD>
              </TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=title_001 align=middle height=34><FONT 
            color=#ff0000><B>综合新闻</B></FONT></TD>
        </TR>
        <TR>
          <TD>
            <HR width="100%" SIZE=1>
          </TD></TR>
        <TR>
          <TD vAlign=top align=left>
            <TABLE cellSpacing=0 cellPadding=0 width="90%" align=center 
border=0>
              <TBODY>
              <TR>
                <TD class=neirong_001 vAlign=top height=300><FONT face=宋体>
                <!--代码开始-->
				<table width="690" border="0">
                    <%  for(i=0;i<15;i++)
  { if(!rs.isAfterLast()){
  %>
  <tr>
    
<td><li><a href="shownews.do?id=<%=rs.getString("id")%>"><%=rs.getString("title")%>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#cccccc>[类别：<%=rs.getString("classes")%>]</font></a></td>
  </tr>
  <%rs.next();
  }
  }
  %>
                  </table>
                  <form name="form1" method="post" action="page.jsp">
  <div align="center"><a href="allnews.jsp?pg=1">首页</a>|
    <%
  if ((pagey-1)>=1){
  %>
    <a href="allnews.jsp?pg=<%=(pagey-1)%>">上一页</a>
    <%}
  else{out.print("上一页");}
  %>
  | 
  <%
  if ((pagey+1)<=pagex){
  %>
  <a href="allnews.jsp?pg=<%=(pagey+1)%>">下一页</a>
  <%}
  else{out.print("下一页");}
  %>
  | <a href="allnews.jsp?pg=<%=pagex%>">尾页</a>&nbsp;每页15条&nbsp;共 <%=pagex%> 页
  <!-- 下拉菜单开始 -->
    <select name="pg" id="pg">
	<%
	int pg1=0;
	for(pg1=1;pg1<=pagex;pg1++){
	%>
      <option value="<%=pg1%>" <%
	if(pagey==pg1)
		{out.print("selected");}	
	%>><%=pg1%></option>
	  	<%}%>
    </select> 

	<!-- 下拉菜单结束 -->
  页
  <input type="submit" name="Submit" value="go">
</div>
</form>
                <!--结束-->  
                  </FONT>
                  
                  <FONT face=宋体><BR>
                  </FONT></TD>
              </TR></TBODY></TABLE>
            <TABLE cellSpacing=0 cellPadding=0 width="90%" align=center 
border=0>
              <TBODY>
             
                <TD class=neirong_001 align=middle>
                  <DIV align=center>【<A href="index.jsp"><FONT 
                  color=#000000>返回主页</FONT></A>】 【<A 
                  href="javascript:window.close()"><FONT 
                  color=#000000>关闭窗口</FONT></A>】</DIV></TD></TABLE>
            <TABLE cellSpacing=0 cellPadding=0 width="90%" align=center 
border=0>
              <TBODY>
              <TR>
                <TD vAlign=top height=50></TD>
              </TR></TBODY></TABLE></TD></TR></TABLE></TD></TR></TBODY></TABLE></DIV>
<DIV align=center>
<jsp:include page="button.jsp"/></DIV></BODY></HTML>
<%
rs.close();
stmt.close();
conn.close();
%>