jsp+oracle(fenye)

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import=
"jfir.smtiger.jdbc.JdbcManager"%>
<%@ page import=
"jfir.smtiger.jdbc.OracleJdbcPage"%>
<%
    JdbcManager jdbc=new JdbcManager();
String tp=request.getParameter(
"thisPage");//分页参数 用于指定当前页
String sqs=
"select point,userid,username from (select t.user_id userid," +
" a.user_name username,sum(t.mind_point)  point from jc_action_log " +
" t,jc_user a where a.user_id=t.user_id" +
" and log_time between to_date(to_char(sysdate,'yyyymmdd'),'yyyymmdd') and sysdate"+
" group by t.user_id,a.user_name) order by point desc"; //查询oracle数据库中的东西用的sql语句
int thisPage = tp==null?1:Integer.parseInt(tp);
//字符串转化整数 作用为:指定当前页数
OracleJdbcPage pages = new OracleJdbcPage(jdbc);
//分页用的bean
pages.setExeSql(sqs);
pages.setFileName(request.getRequestURI());
pages.setPageLine(2);
pages.setThisPage(thisPage);
//指定显示第几页
pages.init();
int pageCount = pages.getPageCount();
//得到总页数
ResultSet rs=pages.getResult();
%>
<script language=javascript type=
"text/javascript">
function doPost_Page(id) {
//分页请求参数传递处理(js)
var frm = document.myForm;
if (isNaN(parseInt(id))) {
id = 1;
}
if (id == 0) {
return;
}
window.location.href = unescape('<%= request.getRequestURI() %>?thisPage='+id);
}
</script>
<%if(thisPage>pageCount) thisPage = pageCount-1;
for(int i=1;i<=Math.min(3,pageCount);i++){%>
                    <td class=
"font8"><a href="javascript:doPost_Page(<%= (thisPage+i>1? thisPage+i-1: 1) %>)"><%= (thisPage+i>1? thisPage+i-1: 1)%></a>
<%}%>
<%

int i=(thisPage-1)*2;
while(rs.next()){

%>
              <tr>
                <td width=
"100" bgcolor="#F5ECFE" class="font8"><strong><%=(++i<10?"0"+i:""+i)%>、<%=rs.getString("username")%></strong></td>
                <td align=
"right"><img src="img/cion7.jpg" width="8" height="11" /></td>
                <td width=
"100"><span class="font8">今日积分:<%=rs.getString("point")%></span></td>
                <td width=
"1">&nbsp;</td>
<%if(rs.next()){%>
                <td width=
"100" bgcolor="#F5ECFE" class="font8"><strong><%=(++i<10?"0"+i:""+i)%>、<%=rs.getString("username")%> </strong></td>
                <td align=
"right"><img src="img/cion7.jpg" width="2" height="12" /></td>
                <td width=
"100" align="right"><span class="font8">今日积分:<%=rs.getString("point")%></span></td>
<%}else{%>
<td width=
"100" bgcolor="#F5ECFE" class="font8">&nbsp;</td>
                <td align=
"right"><img src="img/cion7.jpg" width="2" height="12" /></td>
                <td width=
"100" align="right">&nbsp;</td>
<%}%>
               </tr>
            <tr>
                <td height=
"2" colspan="7" background="img/line2.gif"></td>
               </tr>
   <%}%>
   <tr>
lunzi   2006-07-23 00:55:40 评论:0   阅读:684   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

认证码: (如不清楚,请刷新)


Copyright@2004-2010 powered by YuLog