求大神帮忙
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*" %>
<html>
<head>
<title>测试商品搜索</title>
</head>
<body>
<%@include file="convert.jsp"%>
<%
Connection conn=null;
ResultSet rsAll=null;
Statement stmt=null;
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String strConn="jdbc:sqlserver://localhost:1433;DatabaseName=ShopSystem";
String strUser="sa";
String strPassword="sa";
conn=DriverManager.getConnection(strConn,strUser,strPassword);
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
String strItem=request.getParameter("item");
String strContent=Bytes(request.getParameter("co"));
String strSql="";
if(strItem==null||strItem=="")
{
strSql="select p_id,p_type,p_name,p_price,p_quantity,p_time from product";
}
else
{
strSql="select p_id,p_type,p_name,p_price,p_quantity,p_time from product where "+strItem.trim()+"LIKE'%"+strContent.trim()+"%'";
}
rsAll=stmt.executeQuery("strSql");
}
catch(Exception e){e.printStackTrace();}
%>
<table width=80% border=1 cellspacing=0 align=center>
<tr>
<td><font size=2>商品编号</font></td>
<td><font size=2>商品类别</font></td>
<td><font size=2>商品名称</font></td>
<td><font size=2>商品价格</font></td>
<td><font size=2>商品数量</font></td>
<td><font size=2>上架日期</font></td>
</tr>
<%
String str=(String)request.getParameter("page");
if(str==null)
{
str="0";
}
int pagesize=10;
rsAll.last();
int recordCount=rsAll.getRow();
int maxPage=0;
maxPage=(recordCount%pagesize==0)?(recordCount/pagesize):(recordCount/pagesize+1);
int currentPage=Integer.parseInt(str);
if(currentPage<1)
{
currentPage=1;
}
else
{
if(currentPage>maxPage){currentPage=maxPage;}
}
rsAll.absolute((currentPage-1)*pagesize+1);
for(int i=1;i<pagesize;i++)
{
%>
<tr>
<td><font size=2><%= rsAll.getString("p_id") %></font></td>
<td><font size=2><%= rsAll.getString("p_type") %></font></td>
<td><font size=2><%= rsAll.getString("p_name") %></font></td>
<td><font size=2><%= rsAll.getString("p_price") %></font></td>
<td><font size=2><%= rsAll.getString("p_quantity") %></font></td>
<td><font size=2><%= rsAll.getString("p_time") %></font></td>
<td><font size=2><a href="#">详情</a></font></td>
<td><font size=2><a href="#">购买</a></font></td>
</tr>
<%
try
{
if(!rsAll.next())
{
break;}
}
catch(Exception e){}
}
%>
</table>
<p align=center><font size=2>跳转到:<input type=text name=page size=3>当前页数:【<%= currentPage%>/<%=maxPage%>】 ;
<%
if(currentPage>1)
{
%>
<a href="search_result.jsp?page=1">第一页</a>
<a href="search_result.jsp?page=<%=currentPage-1 %>">上一页</a>
<%
}
if(currentPage<maxPage)
{
%>
<a href="search_result.jsp?page=<%=currentPage+1%>">下一页</a>
<a href="search_result.jsp?page=<%=maxPage %>"></a>
<%
}
rsAll.close();
stmt.close();
conn.close();
%>
</font></p>
</body>
</html>
rsAll=stmt.executeQuery(strSql);
Apache Tomcat/6.0.29
[其他解释]
还是不对,就是找不到错误啊,你们身边有myeclipse的话就调试一下吧,数据库下面那网址里有,跪求答案啊
[其他解释]