易截截图软件、单文件、免安装、纯绿色、仅160KB

jsp分页

源程序
<%String sConn="你的连接"
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection(sConn,"你的用户名","密码");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Statement stmtcount=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery("select * from mytable_view");
String sqlcount="select count(*) from mytable_view";
ResultSet rscount=stmtcount.executeQuery(sqlcount);
int pageSize=你的每页显示纪录数;
int rowCount=0; //总的记录数
while (rscount
int pageCount; //总的页数
int currPage; //当前页数
String strPage;
strPage=request.getParameter("page");
if (strPage==null){
currPage=1;
}
else{
currPage=Integer.parseInt(strPage);
if (currPage<1) currPage=1;
}
pageCount=(rowCount+pageSize-1)/pageSize;
if (currPage>pageCount) currPage=pageCount;
int thepage=(currPage-1)*pageSize;
int n=0;
rs.absolute(thepage+1);
while (n<(pageSize)&&!rs
%>
<%rs.close();
rscount.close();
stmt.close();
stmtcount.close();
conn.close();
%>
//下面是 第几页等
<form name="sinfo" method="post" action="sbinfo_index.jsp?condition=<%=condition%>&type=<%=type%>" onSubmit="return testform(this)">
第<%=currPage%>页 共<%=pageCount%>页 共<%=rowCount%>条
<%if(currPage>1){%><a href="sbinfo_index.jsp?condition=<%=condition%>&type=<%=type%>">首页</a><%}%>
<%if(currPage>1){%><a href="sbinfo_index.jsp?page=<%=currPage-1%>&condition=<%=condition%>&type=<%=type%>">上一页</a><%}%>
<%if(currPage<pageCount){%><a href="sbinfo_index.jsp?page=<%=currPage+1%>&condition=<%=condition%>&type=<%=type%>">下一页</a><%}%>
<%if(pageCount>1){%><a href="sbinfo_index.jsp?page=&l


相关文档:

如何在jsp中读取客户端的excel文件中的数据

我要调用JExcelApi   读取用户在客户端选择的Excel中的文件中的数据,  
  我是这样做的:  
    首先做一个页面upLoadExcel.jsp让用户选择本地的Excel文件,我就是用的上传的那个页面:  
      <!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD &nb ......

组拼jsp方法2

<html:html>
<HEAD>
<tiles:insert attribute="header" />
</HEAD>
<body>
<tiles:insert attribute="top" />
<table width="100%" height="400" border="0" align="center"
 cellpadding="0" cellspacing="0">
 <tr>
  <td width="178" ......

组拼jsp方法3

<table width=100% border="0" align="center" cellpadding="0"
 cellspacing="0">
 <tr>
  <td height="1" class="gray1"></td>
 </tr>
</table>
<tiles:insert attribute="footer" />
</body>
</html:html> ......

MySQL与JSP 乱码问题解决

乱码真是个令人讨厌的问题~
刚才终于把MySQL与JSP交互的乱码问题解决了。
办法如下:
1.在url处加上句子 "&useUnicode=true&characterEncoding=GBK" ;
2.我用Navicat Lite可视化工具创建MySQL数据库时,可选定数据库编码,也是 GBK ;
3.页面的编码可以选GBK以外的编码方式,如UTF-8。若操作页面的编码是UTF- ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号