Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 好用的WEB分页开发包JWebPaging
javabin





发贴: 55
于 2004-09-29 12:29 user profilesend a private message to usersend email to javabinreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
开放源代码的,把常用的JSP分页代码封装的很好!重用性高,也灵活。推荐!
下载和使用介绍去这里www.lucas-lee.com

例子:
<%@ page contentType="text/html; charset=GBK" %>
<%@page import="com.lucaslee.tools.paging.*,java.sql.*,java.util.*" %>
<html>
<head>
<title>
Pageing
</title>
</head>
<body bgcolor="#ffffff">
<%
String tradeMark=request.getParameter("tradeMark");
%>
<form name="form1" action="" method="post">
商标:<input type=text name="tradeMark" value="<%=(tradeMark==null?"":tradeMark)%>">
<input type="submit" value="查询">
</form>
<%

String whereSql=(tradeMark==null?"":" where tradeMark like '%"+tradeMark+"%'");

Connection con=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thinAngryt3:1521:ora",
"username", "username");

BusinessObjFactory f=new BusinessObjFactory(){
public Object getBusinessObj(ResultSet rs)throws PagingException{
Vector v=new Vector();
try{
v.add(rs.getString(1));
v.add(rs.getString(2));
v.add(rs.getString(3));
v.add(rs.getString(4));
} catch(SQLException ex){
ex.printStackTrace();
throw new PagingException(ex.getMessage());
}
return v;
}
};
out.println("<form name=form1>");
Page p=Page.getPage("select countStart from marketpriceview"+whereSql
,"select * from marketpriceview"+whereSql
,con,f,5,request);
out.println(p.getPagingHTMLCode("form1"));
Iterator itr=p.getData().iterator();
int count=0;
out.print("<table border=1 width=\"75%\">");
while(itr.hasNext()){
Vector v=(Vector)itr.next();
count++;
out.print("<tr><td>"+count);
for (int i = 0; i < v.size(); i++) {
out.print("<td>"+(String)v.elementAtLight Bulb);
}
}
out.println("</table>");
out.println(p.getPagingHTMLCode("form1"));
out.println("</form>");
con.close();
%>
</body>
</html>




话题树型展开
人气 标题 作者 字数 发贴时间
961 好用的WEB分页开发包JWebPaging javabin 2038 2004-09-29 12:29

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923