MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 关于输入页数确定后跳转的有关问题

关于输入页数确定后跳转的有关问题

www.MyException.Cn  网友分享于:2013-12-27  浏览:79次
关于输入页数确定后跳转的问题
为什么在上一页,下一页都正常的情况下,输入页数查找时“对不起,没有符合搜索条件的记录!”现将全部代码贴出来,希望帮忙找找原因,修改下
<%@ include file="conn.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%request.setCharacterEncoding("gb2312");
String key=request.getParameter("key");
String stype=request.getParameter("stype");
String gzdd=request.getParameter("gzdd");
String stype1="company" ;
String gzdd1="noxz" ;
if(key==null){
key="";
}
 %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<link rel="stylesheet" href="inc/index.css" type="text/css">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>滁州人才==&gt;人才市场==&gt;站内搜索</title>
</head>
<body topmargin="0" leftmargin="0">
<SCRIPT language=JavaScript src="inc/f-index.js"></SCRIPT>
<div align="center">
  <table border="0" cellpadding="0" cellspacing="0" height="358">
  <tr>  
  <td width="293" height="284" valign="top">
<% 
int intPageSize;
int intRowCount;//记录总数
int intPageCount;//总页数
int intPage;//页面参数
String strPage;//定义变量用来传递page
int i;
intPageSize=5;//定义每页显示5条记录
strPage=request.getParameter("page");//取得当前的页码
if(strPage==null){//判断初始页面,如果没有显示记录,就置为第一页
intPage=1;
}else{
intPage=Integer.parseInt(strPage);//将strPage转化为整数
if(intPage<1) intPage=1;
}
String sqlname,sqlname1;
if(stype1.equals(stype)){
  if(gzdd1.equals(gzdd)){
  sqlname="select * from company where job like '%"+key+"%' or cname like '%"+key+"%' and job is not null order by id desc" ;
  sqlname1="select count(id) from company where job like '%"+key+"%' or cname like '%"+key+"%' and job is not null order by id desc" ;
}else{
  sqlname="select * from company where (job like '%"+key+"%' or cname like '%"+key+"%') and gzdd='"+gzdd+"' and job is not null order by id desc" ; 
sqlname1="select count(id) from company where (job like '%"+key+"%' or cname like '%"+key+"%') and gzdd='"+gzdd+"' and job is not null order by id desc" ;
}
}else
  { 
if(gzdd1.equals(gzdd)){
  sqlname="select * from person where job like '%"+key+"%' or iname like '%"+key+"%' and job is not null order by id desc" ;
sqlname1="select count(id) from person where job like '%"+key+"%' or iname like '%"+key+"%' and job is not null order by id desc" ;
  }else{ 
  sqlname="select * from person where (job like '%"+key+"%' or iname like '%"+key+"%') and gzdd='"+gzdd+"' and job is not null order by id desc" ; 
sqlname1="select count(id) from person where (job like '%"+key+"%' or iname like '%"+key+"%') and gzdd='"+gzdd+"' and job is not null order by id desc" ;
  }
}
ResultSet rt=stmt.executeQuery(sqlname1);
rt.next();
intRowCount=rt.getInt(1);//取得整数保存与intRowCount变量中

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有