关于输入页数确定后跳转的问题
为什么在上一页,下一页都正常的情况下,输入页数查找时“对不起,没有符合搜索条件的记录!”现将全部代码贴出来,希望帮忙找找原因,修改下
<%@ 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>滁州人才==>人才市场==>站内搜索</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" ;
}