分享
 
 
 

表单查询显示翻页等不可用,提示对象不支持此属性或方法,切记查询按钮的name值不能为submit

王朝other·作者佚名  2007-03-16
窄屏简体版  字體: |||超大  

切记查询按钮的name值不能为submit。其中原代码如下:

<input name="submit" type="submit" class="button" style="WIDTH: 80px" value="查询">

我们应当改为:

<input name="submit1" type="submit" class="button" style="WIDTH: 80px" value="查询">,不然会出现表单查询显示是点下一步,将继续向下一页翻页,但是点上一页,下一页,等都不可用。

原代码如下:

<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>

<%@ page import ="pub.*" %>

<%@ page import="leader.*"%>

<%

int x=Check.CheckPage(request,"leader_employee_search");

String userid=(String)session.getAttribute("userid");

LeaderBean leader=new LeaderBean();

String Error="";

if (x==1){

Error="<script>alert('你已掉线,需要重新登陆!');top.location.href='../login.jsp'</script>";

}else{

if (x==2){

Error="<script>alert('你无权进入该页面!');history.back();</script>";

}

if(leader.checkCompetenceCorp(userid)==0){

Error="<script>alert('你无权进入该页面!');history.back();</script>";

}

}

%>

<%=Error%>

<%

if (x!=0){

return;

}

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gbk">

<title>查询其管属员工信息</title>

<link href="../css/putong.css" type="text/css" rel="stylesheet">

<script>

var req;

var number='all'; //外,下拉框可显示全部部门&处

window.onload=function()

{

}

function Change_Select(flag)

{

var flag1=flag;//是为了解决onchange()后值要改变&onload()(查询提交)后值要保存的问题

//alert(flag1);

var zhi = document.getElementById('Corp').value;

var hidden_depart=document.all.HiddenKeyDepart.value;

var hidden_UserID=document.all.HiddenUserId.value;

var url = "../selectCropDepartLeader?state="+number+"&keyDepart="+hidden_depart+"&id=" + escape(zhi)+"&flag="+flag1+"&leaderid="+hidden_UserID;

//alert(url);

if (window.XMLHttpRequest) {

req = new XMLHttpRequest();

}else if (window.ActiveXObject) {

req = new ActiveXObject("Microsoft.XMLHTTP");

}

if(req){

req.open("GET", url, true);

req.onreadystatechange = callback;

req.send(null);

}

}

function callback() {

if (req.readyState == 4) {

if (req.status == 200) {

parseMessage();

// update the HTML DOM based on whether or not message is valid

}else{

alert ("Not able to retrieve description" +req.status+req.statusText);

}

}

}

function parseMessage() {

var xmlDoc = req.responseXML.documentElement;

var xSel = xmlDoc.getElementsByTagName('select');

var select_root = document.getElementById('Depart');

select_root.options.length=0;

for(var i=0;i<xSel.length;i++)

{

var xValue = xSel[i].childNodes[0].firstChild.nodeValue;

var xText = xSel[i].childNodes[1].firstChild.nodeValue;

var option = new Option(xText,xValue);

try

{

select_root.add(option);

}

catch(e)

{

}

}

}

function chan(){

document.formlist.submit();

}

</script>

</head>

<body onload="Change_Select(1)">

<%

String strCorp=request.getParameter("Corp");

String strDepart=request.getParameter("Depart");

//String strPositionName=request.getParameter("PositionName") ;

//String strLeaderName=request.getParameter("LeaderName");

if(strCorp==null) strCorp="";

if(strDepart==null) strDepart="";

//if(strChu==null) strChu="";

//if(strPositionName == null) strPositionName="0";

//if(strLeaderName==null) strLeaderName="";

String strCropID1=(String)session.getAttribute("cropid");

//判断如果登陆员工是总公司之外的就只显示此员工所在的公司

//if(strCropID1.equals("1")==false) strCorp=strCropID1;

Conn conn=new Conn();

DataTable dtChuName=new DataTable();

//String SqlChuName="";

%>

<form name="formlist" method="get" action="leader_employee_search.jsp">

<input type="hidden" name="hiddensql">

<table cellSpacing="0" cellPadding="0" width="100%" bgColor="#bfcae6" border="0" background="../images/subtitle.gif">

<tr>

<td width="100%" height="26"><FONT face="宋体">

<DIV align="left"><FONT face="宋体" color="#ffffff">&nbsp;&nbsp;当前位置:领导查询&gt;&gt;查询其管属员工信息 </FONT>

</DIV>

</FONT>

</td>

</tr>

</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%" background="../images/ico_14.jpg">

<tr>

<td height="26" align="left" nowrap>&nbsp;</td>

<td width="40" align="right" nowrap>公司:</td>

<td width="100" align="left"><select name="Corp" id="Corp" style="WIDTH: 100px" onChange="Change_Select(0)" ></select> </td>

<td width="40" align="right" nowrap>部门:</td>

<td width="100" align="left">

<select name="Depart" id="Depart" style="WIDTH: 100px"></select> </td>

<td width="40" align="left" >

类型: </td>

<td width="80" align="left" ><select name="userstate" onChange="chan();" style="WIDTH: 80px">

<option value="0">在职人员</option>

<option value="1">离职人员</option>

</select></td>

<td width="90" align="right" ><input name="submit1" type="submit" class="button" style="WIDTH: 80px" value="查询"></td>

<td width="90" align="right" ><input name="button1" type="button" class="button" style="WIDTH: 80px" onClick="javascript:window.print();" value="打印"></td>

<td width="10" align="left" >&nbsp;</td>

</tr>

</table>

<%

DataGrid dg=new DataGrid("1",request,"formlist",15,"");

DataGridColumnItem dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="人员编号";

dgci.BindField="UserCode";

dgci.Width="10%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="人员姓名";

dgci.BindField="UserName";

dgci.Width="15%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="公司";

dgci.BindField="CropName";

dgci.Width="10%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="部门";

dgci.BindField="DepartName";

dgci.Width="15%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="性别";

dgci.BindField="Sex";

dgci.Width="10%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="职务";

dgci.BindField="RankName";

dgci.Width="20%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.LinkButtonColumn;

//dgci.HeadText="编辑";

dgci.BindField="详细信息";

dgci.Script="../employee/employee_all_info_detail.jsp?Key=[UserID]";

dgci.Width="20%";

dg.addColumn(dgci);

String cropid=(String)session.getAttribute("cropid");

String roleid=(String)session.getAttribute("roleid");

//System.out.println("userid:"+userid);

String Sql="";

//int a[]=new int[20];

String strCropID[]=new String[100];

String strDepartID[]=new String[100];

DataTable dt =new DataTable();

//String departid=(String)session.getAttribute("departid");

String mSql_competence="Select CropID,DepartID from leadquery02_competence c where c.UserID="+userid+" ";

//System.out.println("testme");

//System.out.println("mSql_competence:"+mSql_competence);

Sql="select DISTINCT a.UserID,UserCode,UserName,b.sex,";

Sql+=" CropName=(Select MachName from sys04_Machine c where a.CropID=c.MachID),";

Sql+=" DepartName=(select MachName from sys04_Machine d where a.DepartID=d.MachID ),";

Sql+=" RankName=(select RankName from Basic02_Rank where Rankid=rank)";

//Sql+=" from employee01_Basic a , employee02_info b ";

//Sql+=" where a.UserID=b.UserID ";

Sql+=" FROM employee01_Basic a LEFT OUTER JOIN employee02_info b ON a.UserID = b.UserID ";

if(conn.querySql(mSql_competence,dt)){

if(dt.getRowCount()>0){

Sql+=" Where ( ";

for(int i=0;i<dt.getRowCount();i++){

strCropID[i] = dt.getItemForName(i,"CropID");

strDepartID[i] = dt.getItemForName(i,"DepartID");

//System.out.println("strCropID:"+strCropID[i]);

//System.out.println("strDepartID:"+strDepartID[i]);

if(i>0 ){

Sql+=" OR ";

}

if(strDepartID[i] != null && strDepartID[i].equals("")==false ){

Sql+=" ( a.CropID="+strCropID[i]+" ";

Sql+=" AND a.DepartID="+strDepartID[i]+" )";

}

else{

Sql+=" ( a.CropID="+strCropID[i]+" )";

}

}

Sql+=" ) ";

//System.out.println("Sqlleader1:"+Sql);

}

}

//System.out.println("Sqlleader:"+Sql);

String userstate=request.getParameter("userstate");

if (userstate!=null){

Sql+=" AND a.UserState='"+userstate+"' ";

out.println("<script>document.all.userstate.value='"+userstate+"';</script>");

}else{

Sql+=" AND a.UserState='0' ";

}

String hiddensql=request.getParameter("hiddensql");

if (hiddensql!=null && hiddensql.length()>0){

Sql+=" and "+hiddensql;

out.println("<script>document.all.hiddensql.value='"+hiddensql+"';</script>");

}

if(strCorp.length()>0)

Sql+=" AND a.CropID = "+PubClass.getString(strCorp)+" ";

if (strDepart.length()>0 && strDepart.equals("Pselect")==false )

Sql+= " AND a.DepartID = "+PubClass.getString(strDepart)+" ";

System.out.println("Sql:"+Sql);

if (conn.execSql(Sql)){

}

else{

response.setCharacterEncoding("GBK");

String LastOperMsg="不能读取权限数据!";

out.println("<script>alert('"+LastOperMsg+"');window.returnValue=0;window.close();</script>");

}

dg.bindSql(Sql);

out.print(dg.ShowGrid());

%>

<%

String m1Script="";

m1Script=PubClass.BindAllCorp_Leader_List("document.all.Corp",userid);

//m1Script=PubClass.BindAllCorpList2("document.all.Corp");

%>

<%= m1Script%>

<%

String sLeaderList="";

//System.out.println("strDepart2:"+PubClass.getString(strDepart));

sLeaderList+="<script>document.all.Corp.value='"+PubClass.getString(strCorp)+"';</script>";

sLeaderList+="<script>document.all.Depart.value='"+PubClass.getString(strDepart)+"';</script>";

%>

<%=sLeaderList%>

<input type="hidden" name="HiddenKeyDepart" value="<%=strDepart%>" >

<input type="hidden" name="HiddenUserId" value="<%=userid%>" >

</form>

</body>

</html>

页面错误如图所示:

注意这里的错误和order by的提示是一样的,但问题不一样。

为了解决这个问题:

我们首先跟踪程序:dg.ShowGrid():

发现要执行:String num=conn.lookupfirst("select count(*) as cnum from ("+mSql+") as awqertc1q ","cnum");

我们将上面打印的sql语句带入这里:

SQl:select DISTINCT a.UserID,UserCode,UserName,b.sex, CropName=(Select MachName from sys04_Machine c where a.CropID=c.MachID), DepartName=(select MachName from sys04_Machine d where a.DepartID=d.MachID ), RankName=(select RankName from Basic02_Rank where Rankid=rank) FROM employee01_Basic a LEFT OUTER JOIN employee02_info b ON a.UserID = b.UserID Where ( ( a.CropID=1 ) OR ( a.CropID=202 AND a.DepartID=207 ) OR ( a.CropID=1 ) OR ( a.CropID=1 ) OR ( a.CropID=202 ) OR ( a.CropID=253 ) OR ( a.CropID=202 AND a.DepartID=207 ) OR ( a.CropID=202 AND a.DepartID=207 ) OR ( a.CropID=202 AND a.DepartID=209 ) OR ( a.CropID=202 ) OR ( a.CropID=204 ) OR ( a.CropID=204 ) ) AND a.UserState='0'

我们将它在sqlserver中执行,发现没有问题:

我们再将它传入到上面的lookupfirst函数当中,mSql为上面打印的sql语句:

select count(*) as cnum from ("+mSql+") as awqertc1q

结果显示没有问题(注意的是如果带入排序,就会出现问题,这个问题比较深奥,我们以后再说。)

那么这是什么问题呢?难道真的是和排序一样出现的实现小数据量和海量数据的通用分页显示存储过程出现的问题一样吗?于是我也仿照对排序的解决方法一样,在select前加入top 100 percent 但是却不能显示!!!! 如此难道这又是实现小数据量和海量数据的通用分页显示存储过程出现的问题,而且是不同形式,连top 100 percen都不能用?我们再继续跟踪代码,看看基础代码是怎么实现的,如果要改动基础代码,将对整个系统产生巨大的影响。但出现问题我们必须解决,只好硬着头皮看下去,为了,跟踪系统代码:

public String ShowGrid(){

try{

String Table="";

Conn conn=new Conn();

String num=conn.lookupfirst("select count(*) as cnum from ("+mSql+") as awqertc1q ","cnum");

if (num.trim().length()<1) num="0";

int CountNum=Integer.parseInt(num);

int CurrentNum=1;

if (mRequest.getParameter(getHiddenContolID())!=null){

String m=mRequest.getParameter(getHiddenContolID());

if (m.trim().length()<1) m="0";

CurrentNum=Integer.parseInt(m);

}

//if (mRequest.getParameter(getChangePageContolID())!=null){

// String m=mRequest.getParameter(getChangePageContolID());

// if (m.trim().equals("0")){

// CurrentNum=1;

// }

//}

//Table+="select count(*) as cnum from ("+mSql+") as a ";

int Pagecount= (CountNum+mRowInPage-1)/mRowInPage;

Table+=getGridJavascriptFun(CurrentNum,CountNum,Pagecount);

Table+=getGridTable(CurrentNum,CountNum,Pagecount);

//System.out.println("Table:"+Table);

return Table;

}catch(Exception e){

return e.getMessage();

}

}

我们将Table 打印出来:

<script>

function LastPage1Fun()

{

document.all.datagrid1_pageno.value='31';

document.all.datagrid1_changepage.value='1';

window.document.formlist.submit();

}

function JumpPage1Fun(){

document.all.datagrid1_pageno.value=document.all.datagrid1_ump.value;

document.all.datagrid1_changepage.value='1';

window.document.formlist.submit();

}

function NextPage1Fun()

{

document.all.datagrid1_pageno.value='2';

document.all.datagrid1_changepage.value='1';

window.document.formlist.submit();

}

function prePage1Fun()

{

document.all.datagrid1_pageno.value='1';

document.all.datagrid1_changepage.value='1';

window.document.formlist.submit();

}

function FirstPage1Fun()

{

document.all.datagrid1_pageno.value='1';

document.all.datagrid1_changepage.value='1';

window.document.formlist.submit();

}

function page1chk(id,trueOrFalse){

if(trueOrFalse==null) trueOrFalse=true;

var chks=document.getElementsByName(id);

for (var i=0;i<chks.length;i++)

chks[i].checked=trueOrFalse;

page1chkdata(id);

}

function page1chkdata(id){

document.all.datagrid1_checkvalue.value='';

var chks=document.getElementsByName(id);

for (var i=0;i<chks.length;i++){

if (chks[i].checked){

document.all.datagrid1_checkvalue.value+=chks[i].value+',';

}

}

var a=document.all.datagrid1_checkvalue.value.length ;

if (a>0){

document.all.datagrid1_checkvalue.value=document.all.datagrid1_checkvalue.value.substr(0,a-1);

}

}</script>

<body>

<form>

<input type='Hidden' Name='datagrid1_pageno' value='1'>

<input type='Hidden' Name='datagrid1_changepage' value='0'>

<table cellspacing='0' cellpadding='2' rules='all' TableBackColor='#DBDBDB' TablelineColor='#000000' TableWidth='100%' TableCellpadding='3' IsPicbutton='False' TitleColor='#000000' IsShowDelChk='True' PageNO='1' TableColor='#000000' Insert_ShowScroll='False' AllPage='1' bordercolor='#124D70' border='1' id='WGrid1' style='border-color:#124D70;width:100%;border-collapse:collapse;'>

<tr class='ListTableHeader' align='Center' style='color:Black;background-color:#E7EFFF;'>

<td style='width:10%;'>人员编号</td>

<td style='width:15%;'>人员姓名</td>

<td style='width:10%;'>公司</td>

<td style='width:15%;'>部门</td>

<td style='width:10%;'>性别</td>

<td style='width:20%;'>职务</td>

<td style='width:20%;'></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000001</td>

<td Align='center'>唐运祥</td>

<td Align='center'>总公司</td>

<td Align='center'>公司领导</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=1">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000002</td>

<td Align='center'>傅助</td>

<td Align='center'>总公司</td>

<td Align='center'>公司领导</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=2">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000003</td>

<td Align='center'>宋福兴</td>

<td Align='center'>总公司</td>

<td Align='center'>公司领导</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=3">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000005</td>

<td Align='center'>傅安平</td>

<td Align='center'>总公司</td>

<td Align='center'>公司领导</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=4">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000006</td>

<td Align='center'>松下敏彦</td>

<td Align='center'>总公司</td>

<td Align='center'>公司领导</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=5">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000018</td>

<td Align='center'>张海山</td>

<td Align='center'>总公司</td>

<td Align='center'>公司领导</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=6">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000019</td>

<td Align='center'>王梦飞</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>女</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=7">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000020</td>

<td Align='center'>吴剑</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=8">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000021</td>

<td Align='center'>徐喆</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=9">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000022</td>

<td Align='center'>田靓</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=10">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000023</td>

<td Align='center'>刘歆</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=11">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000024</td>

<td Align='center'>巴音</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=12">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000025</td>

<td Align='center'>于勇</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=13">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000026</td>

<td Align='center'>彭晓敏</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>女</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=14">详细信息</a></td>

</tr><tr align='Center' onmouseover="objColor=this.style.backgroundColor;this.style.backgroundColor='#FFF0CC'" onmouseout='this.style.backgroundColor=objColor' style="color:#000066;'">

<td Align='center'>000027</td>

<td Align='center'>杨建灵</td>

<td Align='center'>总公司</td>

<td Align='center'>办公室</td>

<td Align='center'>男</td>

<td Align='center'></td>

<td Align='center'><a href="../employee/employee_all_info_detail.jsp?Key=15">详细信息</a></td>

</tr><tr align="Right" style="color:#000066;background-color:#DFDFDF;">

<td colspan='7'>

<table border="0" style="color:#000066;background-color:#DFDFDF;border-width:0px;width:100%;">

<tr>

<td align="Left" style="width:15%;">

<a disabled="disabled" title="首页" style="font-family:webdings;font-size: 11pt;" onclick="FirstPage1Fun(); ">9</a>

<font style='font-family:Arial;font-size:9pt'> </font>

<a disabled="disabled" title="上一页" style="font-family:webdings;font-size: 11pt;">7</a>

<font style='font-family:Arial;font-size:9pt'> </font>

<a style="cursor:hand; color:#0A52CB" title="下一页" style="font-family:webdings;font-size: 11pt;" onclick="NextPage1Fun();">8</a>

<font style='font-family:Arial;font-size:9pt'> </font>

<a title="尾页" onclick="LastPage1Fun();" style="font-family:webdings;font-size: 11pt; ">:</a>

</td><td align="Left" style="font-family:宋体;font-size:9pt">

页次:<font color="#E23000">

<input name='datagrid1_ump' class="input" type="text" value="1" maxlength="3" onchange="JumpPage1Fun(); " language="javascript"

style="border-style:Groove;font-family:宋体;font-size:9pt;height:18px;width:18px;text-align :Center;" /><b>/31</b></font>

每页<font color="#E23000"><b>15</b></font>

条 共有记录<font color="red"><b>459</b></font>条

</td>

</tr>

</table>

</td>

</tr>

</table>

然后新建一个页面:1.jsp

在dreamver显示结果如下

然后我们发现NextPage1Fun()是javscrip脚本,我想会不会是用于我的sql代码中用了or所以导致NextPage1Fun()值有问题(可能哪个对象在莫中情况下未赋值),或者是我原先说过的小数据量和海量数据的通用分页显示存储过程出现的问题,如此将要更改系统的基础实现!!!,但是我们必须先将问题缩小到小的范围内,不能先认定到莫个原因,这时分析程序和事务的关键,如此我们才能找到本质原因。

那么由于领导权限上面的公司-部门联动和其他地方不同,是采用不同的算法实现,会不会是它的问题,我于是将 <body onload="Change_Select(1)">中的onload="Change_Select(1)"去掉,以便消除此二级联动的影响。但然而有问题。会不是是参数当莫个时候取空值造成的影响呢?但是那么多参数如何确定??

于是,我就想到了一个简单办法,从简单到复杂一步一步迭代。

我先将第一页显示的sql语句取出,直接显示,看是后台问题,还是是我原先说过的小数据量和海量数据的通用分页显示存储过程出现的问题,因为这里用了OR这个特殊的关键字。(排序 需要在select语句前加 top 100 percent)。

<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>

<%@ page import ="pub.*" %>

<%@ page import="leader.*"%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gbk">

</head>

<body>

<form name="formlist" method="post" action="test.jsp">

<input name="submit1" type="submit" class="button" style="WIDTH: 80px" value="查询">

<%

DataGrid dg=new DataGrid("1",request,"formlist",15,"");

DataGridColumnItem dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="人员编号";

dgci.BindField="UserCode";

dgci.Width="10%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="人员姓名";

dgci.BindField="UserName";

dgci.Width="15%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="公司";

dgci.BindField="CropName";

dgci.Width="10%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="部门";

dgci.BindField="DepartName";

dgci.Width="15%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="性别";

dgci.BindField="Sex";

dgci.Width="10%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.BindDataColumn;

dgci.HeadText="职务";

dgci.BindField="RankName";

dgci.Width="20%";

dg.addColumn(dgci);

dgci=new DataGridColumnItem();

dgci.ColType=ColumnItemType.LinkButtonColumn;

//dgci.HeadText="编辑";

dgci.BindField="详细信息";

dgci.Script="../employee/employee_all_info_detail.jsp?Key=[UserID]";

dgci.Width="20%";

dg.addColumn(dgci);

String Sql="";

Sql="select DISTINCT a.UserID,UserCode,UserName,b.sex, CropName=(Select MachName from sys04_Machine c where a.CropID=c.MachID), DepartName=(select MachName from sys04_Machine d where a.DepartID=d.MachID ), RankName=(select RankName from Basic02_Rank where Rankid=rank) FROM employee01_Basic a LEFT OUTER JOIN employee02_info b ON a.UserID = b.UserID Where ( ( a.CropID=1 ) OR ( a.CropID=202 AND a.DepartID=207 ) OR ( a.CropID=1 ) OR ( a.CropID=1 ) OR ( a.CropID=202 ) OR ( a.CropID=253 ) OR ( a.CropID=202 AND a.DepartID=207 ) OR ( a.CropID=202 AND a.DepartID=207 ) OR ( a.CropID=202 AND a.DepartID=209 ) OR ( a.CropID=202 ) OR ( a.CropID=204 ) OR ( a.CropID=204 ) ) AND a.UserState='0' ";

dg.bindSql(Sql);

out.print(dg.ShowGrid());

%>

</form>

</body>

</html>

我们第一次没有加查询按钮,发现程序没问题,但是当加了查询按钮之后,竟然出了问题。说明这个查询有问题!!!我向我们项目经理说明了情况,我以为后台代码与这个查询有冲突,他说他曾经在网上看到了,这个<input name="submit" type="submit" class="button" style="WIDTH: 80px" value="查询">的名字和type不能一样!!!

将它改为name="submit1",测试,问题解决。真是山穷水复疑无路,柳暗花明又一村

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有