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

📄 xq_list.jsp

📁 实现商品的管理与查询,用JSP+ACCESS开发
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.io.*,java.sql.*" errorPage="errorpage.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>需求一览</title>
<style type="text/css">
<!--
.STYLE1 {
	font-family: "方正新舒体简体";
	font-size: 12px;
}
.STYLE7 {font-family: "方正新舒体简体"; font-size: 14px; }
.style8 {font-size: 12px}
-->
</style>
</head>

<body>
<table width="950" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#99CC33">
  <!--DWLayoutTable-->
  <tr>
    <td height="100" valign="top"><table width="100%" height="100" border="0">
      <tr>
        <td width="29%"><img src="image/logo1.jpg" width="270" height="100" /></td>
        <td width="71%"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="670" height="100">
          <param name="movie" value="flash/fm.swf" />
          <param name="quality" value="high" />
          <embed src="flash/fm.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="670" height="100"></embed>
        </object></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="20" valign="middle"><img src="image/daoheng.jpg" width="950" height="20" border="0" usemap="#Map" /></td>
  </tr>
  <tr>
    <td height="20" valign="middle"><marquee behavior="scroll" align="bottom" direction="right" bgcolor="#99CC33" width="950" loop="-1" scrollamount="2" scrolldelay="10">
      <span class="STYLE1">欢迎光临中南公司科技有限公司</span>
    </marquee></td>
  </tr>
  <tr>
    <td height="430" valign="top">
	  <p class="style8">当前位置:<a href="index.html">首页</a>&gt;<a href="gqxs.html">供求信息</a>&gt;需求信息</p>
	  <table border="1" cellspacing="1" cellpadding="1" align="center" >
<tr>
  <td align=center><font color="#0033CC">编号</font></td>
  <td align=center><font color="#0033CC">方式</font></td>
  <td align=center><font color="#0033CC">标题</font></td>
  <td align=center><font color="#0033CC">期效</font></td>
  <td align=center><font color="#0033CC">发布日期</font></td>
  <td align=center><font color="#0033CC">联系电话</font></td>
</tr>
<%
Connection con=null;
try{
	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	//userManage是odbc数据源的名称
	con=DriverManager.getConnection("jdbc:odbc:zn","","");	
	Statement stmt=con.createStatement();	

//定义每页的纪录行数(pageLine)、当前页(intPage,初始值为1)、总纪录数(totalRec)、总页数(intPageCount)
//String page = request.getParameter("page");
//String page = request.getParameter("page");
String str_page = request.getParameter("page");
if(str_page==null)
	str_page = "1";//初始化;
int intPage = Integer.parseInt(str_page);//字符转为int;
if(intPage<1)   intPage=1;
int thisPage = intPage;//记录为第几页.
int totalRec= 0;
int intPageCount=0;
int pageLine= 20;//设定每页20行

//取得总纪录数代码如下:
String sql1="select count(*)as cnt from gq";
        ResultSet rs_totalRec=stmt.executeQuery(sql1);//
        if(rs_totalRec.next())
         totalRec=rs_totalRec.getInt("cnt");
        rs_totalRec.close();
// 取得总页数代码如下:
    intPageCount=(totalRec+pageLine-1)/pageLine;
//user是数据库中的表名
	ResultSet rs=stmt.executeQuery("select * from gq where style='需求'");	

if(intPageCount>0)//如果总页数大于0,则执行下面语句
{ 
   for(int m=1;m<=(thisPage-1)*pageLine;m++)
	//页循环
   rs.next();//分页定位,确定开始显示的数据位置。
for(int i=1;i<=pageLine;i++){
		if(rs.next()){
		String a=rs.getString("id");
%>  
<tr><td  align=center><font color="#3366FF"><%=rs.getString("bm")%></font></td>
    <td  align=center><font color="#3366FF"><%=rs.getString("style")%></font></td>
	<td  align=center><font color="#3366FF"><%=rs.getString("bt")%></font></td>
    <td  align=center><font color="#3366FF"><%=rs.getString("yxq")%></font></td>
    <td  align=center><font color="#3366FF"><%=rs.getString("data")%></font></td>
	<td  align=center><font color="#3366FF"><%=rs.getString("tel")%></font></td>
</tr>
<%	
	}// if(rs.next())-end   
	}// for(int i=1;i<=pageLine;i++)-end
}//if(intPageCount>0)-end
else 
	{out.println("<tr>数据库为空</tr>");
}
%>
<tr>
	<td><font color="#3366FF">第 <%=intPage%>页/共 <%=intPageCount%> 页</font></td>
<%
	if(intPage <2) {
%>
	<td><font color="#3366FF">【首页】</font></td>
	<td><font color="#3366FF">【上一页】</font></td>
    <td>&nbsp;</td>
    <%
}else {
%>
<td><a href="ilist.jsp?page=1">【首页】</a></td>
<td><a href="ilist.jsp?page=<%=thisPage-1%>">【上一页】</a></td>
<%
}//if--else--end
	if(intPage - intPageCount >=0)//如果当前页数小于等于总页数,下一页和尾页出现链接
	{
%>
	<td><font color="#3366FF">【下一页】</font></td>
	<td><font color="#3366FF">【尾页】</font></td>
<%
}else{
%>
  	<td><a href="ilist.jsp?page=<%=thisPage+1%>">【下一页】</a></td>
	<td><a href="ilist.jsp?page=<%=intPageCount%>">【尾页】</a></td>
<%
}//if--else--end
%>
<%
	rs.close();
	stmt.close();
	con.close();
	}//try-end
	catch(Exception e){
	out.println(e.getMessage());
	}//catch
%>
</table></td>
  </tr>
  <tr>
    <td height="40" valign="top"><table width="100%" border="0">
      <tr>
        <td height="30" align="center" valign="middle"><span class="STYLE7">本系统适合于在1024*768分辨率下使用<br />
        联系方式:0759-2470331</span></td>
      </tr>
      <tr>
        <td height="10" bgcolor="#99CC33">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>

<map name="Map" id="Map"><area shape="rect" coords="55,2,105,22" href="index.html" />
<area shape="rect" coords="134,2,212,17" href="zddh.html" />
<area shape="rect" coords="250,3,324,21" href="scgk.html" />
<area shape="rect" coords="359,4,435,26" href="jyzx.html" />
<area shape="rect" coords="469,3,550,26" href="gqxs.html" />
<area shape="rect" coords="583,3,658,27" href="zszq.html" />
<area shape="rect" coords="695,1,773,21" href="lxwm.html" />
<area shape="rect" coords="804,3,885,30" href="htgl.jsp" />
</map></body>
</html>

⌨️ 快捷键说明

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