<%
int intPageSize = 0;
int intRowCount = 0;
int intPageCount = 0;
int intPage = 0;
java.lang.String strPage = "";
int iCount = 0;
int iCount2 = 0;
int iCount3 = 0;
String strNumber = null;
Connection queryConn = null;
PreparedStatement queryPreStmt = null;
String querySql = null;
ResultSet queryRs = null;
try {
queryConn = dbConn.getconnection("jdbc/ADIMSDB");
querySql = "select to_char(noticedate,'yy-mm-dd hh24:mi') as noticedate,noticeid,noticeposter,notice,noticetitle from adims_xtwh_notices order by noticedate desc";
queryPreStmt = queryConn.prepareStatement(querySql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
queryRs = queryPreStmt.executeQuery();
queryRs.last();
intRowCount = queryRs.getRow();
intPageSize = ((ConfigBean)application.getAttribute("configBean")).getRecordPerPage();
strPage = request.getParameter("page");
if(strPage==null){
intPage=1;
}
else{
intPage=java.lang.Integer.parseInt(strPage);
if(intPage<1) intPage=1;
}
intPageCount = (intRowCount+intPageSize-1)/intPageSize;
if(intPage>intPageCount) intPage=intPageCount;
if(intPageCount<=0) {
//throw new Exception("没有数据!");
out.println("<tr><td colspan='6'><div align='center'><font color='#FF9900'>对不起,没有符合要求的数据!</font></div></td></tr>");
out.close();
}
queryRs.absolute((intPage-1)*intPageSize+1);
while ((iCount<intPageSize) && !queryRs.isAfterLast()) {
strNumber = "isSelected";
strNumber = strNumber.concat(String.valueOf(iCount2));
%>
<tr<%
if (iCount3 == 0) {
out.println(" bgcolor='#F9F5E7'");
}
%>>
<td align="center" height="20"><input name="<%=strNumber%>" type="checkbox" id="<%=strNumber%>" value="1" class="inputNone"></td>
<td align="center" height="20"><input name="noticeID" id="noticeID" type="hidden" value="<%=queryRs.getString("noticeid")%>"><%=queryRs.getString("noticeid")%></td>
<td align="center" height="20"><%=queryRs.getString("noticedate")%></td>
<td align="center" height="20"><%=queryRs.getString("noticeposter")%></td>
<td height="20"><a href="NoticesDetail.jsp?NoticeID=<%=queryRs.getString("noticeid")%>" target="_blank"><%=queryRs.getString("noticetitle")%></a></td>
<td height="20"><%
if (queryRs.getString("notice").length() > 20) {
out.println(queryRs.getString("notice").substring(0,21) + "......");
}
else {
out.println(queryRs.getString("notice"));
}
%></td>
<td align="center" height="20"><a href="NoticesDetail.jsp?modify=1&NoticeID=<%=queryRs.getString("noticeid")%>"><img src="../images/mod.gif" border="0"></a></td>
</tr>
<%
if (++iCount3 == 2) {
iCount3 = 0;
}
queryRs.next();
iCount++;
iCount2++;
}
}
catch (Exception e) {
if (e.getMessage().equals("用尽的 Resultset")) {
throw new Exception("记录不存在,请重新查询!");
}
else {
throw e;
}
}
finally {
/*
if (queryPreStmt != null) {
try {
queryPreStmt.close();
}
catch (SQLException dbE) {
throw new Exception(dbE.getMessage());
}
queryPreStmt = null;
}
*/
if (queryConn != null) {
try {
queryConn.close();
}
catch (SQLException dbE) {
throw new Exception(dbE.getMessage());
}
queryConn = null;
}
}
%>
<tr>
<td colspan="6" align="center"> <input type="hidden" name="count" id="count" value="<%=iCount2%>">
<input type="button" name="selectAll" id="selectAll" onClick="selectAllCheckBox(<%=iCount2%>);" value="全选">
<input type="button" name="reverseAll" id="reverseAll" onClick="reverseAllCheckBox(<%=iCount2%>);" value="清除选择">
<%if (((String)session.getAttribute("manage_right")).equals("true")) {%>
<input type="button" name="delete" value="删除" onClick="noticesDelete(<%=iCount2%>);">
<%}%>
</td>
</tr>
</table>
</td>
</form>
</tr>
<tr class="10point" bgcolor="#5A82C6">
<td>这里是分页代码</td>
</tr>
</table>
<%@ include file="../public/Footer.jsp"%>
</body>
</html>恳请高手能够指导下
int intPageSize = 0;
int intRowCount = 0;
int intPageCount = 0;
int intPage = 0;
java.lang.String strPage = "";
int iCount = 0;
int iCount2 = 0;
int iCount3 = 0;
String strNumber = null;
Connection queryConn = null;
PreparedStatement queryPreStmt = null;
String querySql = null;
ResultSet queryRs = null;
try {
queryConn = dbConn.getconnection("jdbc/ADIMSDB");
querySql = "select to_char(noticedate,'yy-mm-dd hh24:mi') as noticedate,noticeid,noticeposter,notice,noticetitle from adims_xtwh_notices order by noticedate desc";
queryPreStmt = queryConn.prepareStatement(querySql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
queryRs = queryPreStmt.executeQuery();
queryRs.last();
intRowCount = queryRs.getRow();
intPageSize = ((ConfigBean)application.getAttribute("configBean")).getRecordPerPage();
strPage = request.getParameter("page");
if(strPage==null){
intPage=1;
}
else{
intPage=java.lang.Integer.parseInt(strPage);
if(intPage<1) intPage=1;
}
intPageCount = (intRowCount+intPageSize-1)/intPageSize;
if(intPage>intPageCount) intPage=intPageCount;
if(intPageCount<=0) {
//throw new Exception("没有数据!");
out.println("<tr><td colspan='6'><div align='center'><font color='#FF9900'>对不起,没有符合要求的数据!</font></div></td></tr>");
out.close();
}
queryRs.absolute((intPage-1)*intPageSize+1);
while ((iCount<intPageSize) && !queryRs.isAfterLast()) {
strNumber = "isSelected";
strNumber = strNumber.concat(String.valueOf(iCount2));
%>
<tr<%
if (iCount3 == 0) {
out.println(" bgcolor='#F9F5E7'");
}
%>>
<td align="center" height="20"><input name="<%=strNumber%>" type="checkbox" id="<%=strNumber%>" value="1" class="inputNone"></td>
<td align="center" height="20"><input name="noticeID" id="noticeID" type="hidden" value="<%=queryRs.getString("noticeid")%>"><%=queryRs.getString("noticeid")%></td>
<td align="center" height="20"><%=queryRs.getString("noticedate")%></td>
<td align="center" height="20"><%=queryRs.getString("noticeposter")%></td>
<td height="20"><a href="NoticesDetail.jsp?NoticeID=<%=queryRs.getString("noticeid")%>" target="_blank"><%=queryRs.getString("noticetitle")%></a></td>
<td height="20"><%
if (queryRs.getString("notice").length() > 20) {
out.println(queryRs.getString("notice").substring(0,21) + "......");
}
else {
out.println(queryRs.getString("notice"));
}
%></td>
<td align="center" height="20"><a href="NoticesDetail.jsp?modify=1&NoticeID=<%=queryRs.getString("noticeid")%>"><img src="../images/mod.gif" border="0"></a></td>
</tr>
<%
if (++iCount3 == 2) {
iCount3 = 0;
}
queryRs.next();
iCount++;
iCount2++;
}
}
catch (Exception e) {
if (e.getMessage().equals("用尽的 Resultset")) {
throw new Exception("记录不存在,请重新查询!");
}
else {
throw e;
}
}
finally {
/*
if (queryPreStmt != null) {
try {
queryPreStmt.close();
}
catch (SQLException dbE) {
throw new Exception(dbE.getMessage());
}
queryPreStmt = null;
}
*/
if (queryConn != null) {
try {
queryConn.close();
}
catch (SQLException dbE) {
throw new Exception(dbE.getMessage());
}
queryConn = null;
}
}
%>
<tr>
<td colspan="6" align="center"> <input type="hidden" name="count" id="count" value="<%=iCount2%>">
<input type="button" name="selectAll" id="selectAll" onClick="selectAllCheckBox(<%=iCount2%>);" value="全选">
<input type="button" name="reverseAll" id="reverseAll" onClick="reverseAllCheckBox(<%=iCount2%>);" value="清除选择">
<%if (((String)session.getAttribute("manage_right")).equals("true")) {%>
<input type="button" name="delete" value="删除" onClick="noticesDelete(<%=iCount2%>);">
<%}%>
</td>
</tr>
</table>
</td>
</form>
</tr>
<tr class="10point" bgcolor="#5A82C6">
<td>这里是分页代码</td>
</tr>
</table>
<%@ include file="../public/Footer.jsp"%>
</body>
</html>恳请高手能够指导下
解决方案 »
- 高手请尽快进来 急
- MyEclipse如何打包或编译
- struts2 iterator 标签的问题
- axis2提供web服务时如何添加类库。。
- 关于Eclipse手动配置struts2的问题
- 使用Axis,配置服务器A和客户端B(两个不同的服务),我想B调用A的action,如何在wsdd操作?谢谢各位!
- 给个jmail stmp的发送列子
- hibernate的blob问题
- 没有Borland AppServer,JBuilder下WebLogic或JBoss等能否正常运行
- javax.ejb.*在哪里可以下到?
- jsp页面如何打开Excel文件....加急电报!!!
- sun公司是不是有病啊?连个时间控件都不提供?
只是稍微负杂一点(比简单用例),功能强大一点罢了