<%
String type1,keyword,type2;
type1=request.getParameter("ttt");
keyword=request.getParameter("keyword");
type2=request.getParameter("item2"); %>
<%if(type2.equals("编程基础")){
sql="select * from 111 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("数据库类")){sql="select * from 222 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("网络相关")){
sql="select * from 333 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("图形相关")){
sql="select * from 444 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("工具书类")){
sql="select * from 555 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("其他书籍")){
sql="select * from 666 where "+type1+" like '%"+keyword+"%'"; }%>
String type1,keyword,type2;
type1=request.getParameter("ttt");
keyword=request.getParameter("keyword");
type2=request.getParameter("item2"); %>
<%if(type2.equals("编程基础")){
sql="select * from 111 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("数据库类")){sql="select * from 222 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("网络相关")){
sql="select * from 333 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("图形相关")){
sql="select * from 444 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("工具书类")){
sql="select * from 555 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("其他书籍")){
sql="select * from 666 where "+type1+" like '%"+keyword+"%'"; }%>
<%@ page contentType="text/html;charset=gb2312"%>
<%
String type1,keyword,type2;
type1=request.getParameter("ttt");
keyword=request.getParameter("keyword");
type2=request.getParameter("item2"); %>
<html>
<head>
<title>搜索结果</title>
<style>
a{font-size=9pt;}
</style>
</head>
<body style="font-size:9pt;"><%
int pgsz,page_no,page_count,rs_count;
pgsz=5;
String temp=request.getParameter("page_no");
if(temp==null)
page_no=1;
else
page_no=Integer.valueOf(temp).intValue();
String sql="";
String sql1;
//sql1="select count(*) as count1 from book";
if(type2.equals("编程基础")){
sql="select * from 111 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("数据库类")){sql="select * from 222 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("网络相关")){
sql="select * from 333 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("图形相关")){
sql="select * from 444 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("工具书类")){
sql="select * from 555 where "+type1+" like '%"+keyword+"%'"; }
if(type2.equals("其他书籍")){
sql="select * from 666 where "+type1+" like '%"+keyword+"%'"; }
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:source";
Connection con=DriverManager.getConnection(url);
Statement statement=con.createStatement();
ResultSet result=statement.executeQuery(sql);
rs_count=0;
while(result.next()) rs_count++;
if (rs_count%pgsz==0)
page_count=rs_count/pgsz;
else
page_count=rs_count/pgsz+1;
%>
<center>
<font color="red" size="4">共有书目</font><font color="red"> <font size="4">
<%out.println(rs_count);%>
</font> <font size="4">本</font></font>
<table border="0" cellspacing="0" cellpadding="0" width="434" bgcolor="#FFCC99" align="center">
<%
String book_publisher,book_name,book_author;
result=statement.executeQuery(sql); for(int i=0;i<(page_no-1)*pgsz;i++) result.next();
for(int j=0;j<pgsz;j++)
if(result.next())
{
book_name=result.getString("书名");
book_publisher=result.getString("出版社");
book_author=result.getString("作者");
%>
<tr><td height="93" width="400">
<p><a href="search_link.jsp"><%=book_name%></a></p>
<p>作者:<%=book_author%> 出版社:<%=book_publisher%> 出版日期:</p>
</td></tr>
<% }
%>
<tr bgcolor="yellow">
<td colspan="5" align="center">
<%if (page_no>1){%>
<a href="save.jsp?ttt=<%=type1%>&keyword=<%=keyword%>&page_no=1&item2=<%=type2%>">[首页]</a>
<a href="save.jsp?ttt=<%=type1%>&keyword=<%=keyword%>&page_no=<%=page_no-1%>&item2=<%=type2%>">[上一页]</a>
<%}for (int i=1;i<=page_count;i++){%>
<%if (page_no!=i){%>
<a href="save.jsp.jsp?ttt=<%=type1%>&keyword=<%=keyword%>&page_no=<%=i%>&item2=<%=type2%>"><%=i%></a>
<%}else{%>
<%=i%>
<%}}if (page_no<page_count){%>
<a href="save.jsp.jsp?ttt=<%=type1%>&keyword=<%=keyword%>&page_no=<%=page_count%>&item2=<%=type2%>">[尾页]</a>
<a href="save.jsp.jsp?ttt=<%=type1%>&keyword=<%=keyword%>&page_no=<%=page_no+1%>&item2=<%=type2%>">[下一页]</a>
<%}%>
</td>
</tr>
<%
con.close();
}catch(Exception e)
{out.println(e);}
%>
</table>
</center>
</body>
</html>
<%@ include file="head.inc"%>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="workM" scope="page" class="test.faq" />
<jsp:useBean id='clock' scope='page' class='dates.JspCalendar' type="dates.JspCalendar" />
<link href="../CSS/SITE.CSS" rel="stylesheet" type="text/css">
<%!
public String getStr(String str)
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("GBK");
String temp=new String(temp_t,"GB2312");
return temp;
}
catch(Exception e)
{
}
return "null";
}
%>
<%!
public static String category(int id)
{
try
{
switch(id)
{
case 1:
return "计算机类";
//break;
case 2:
return "英语类";
//break;
default:
return "其他类";
//break;
}
}
catch(Exception e)
{
}
return "null";
}
%>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=760 align="center">
<TBODY>
<tr><td align="left" height=25>当前位置:<a href="../index.jsp">首页</a> => 查询商品 </td>
<%@ include file="../member/date.inc"%>
</tr>
<TR bgColor=#3399ff>
<TD height=1 colspan="2"><IMG height=1 src="images/spacer.gif"
width=16></TD></TR>
<tr><td height=10 colspan="2"><IMG height=1 src="images/spacer.gif"
width=16></td></tr>
</TBODY></TABLE> <table align="center" border="0" width="760" cellspacing="0" cellpadding="0" height="355">
<tr>
<td width="10" height="100%"></td>
<td width="1" height="100%" bgcolor="#3399ff"></td>
<td width="10" height="100%"></td>
<td width="100%" height="331" valign="top" background="images/bg1.gif">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" width="100%" height="20"> 站内搜索 => 关键字:<b><font color="Red"><%=request.getParameter("keyword")%></font></b>
</td>
</tr>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="42%" height="20"> <i>标题</i>
</td>
<td width="20%" height="20"> <i>作者</i>
</td>
<td width="20%" height="20"> <i>类别</i>
</td>
<td width="18%" height="20"> <i>详细资料</i>
</td>
</tr>
<ul>
<%
String keyword,way;
String strSQL;
keyword=request.getParameter("keyword");
keyword=(keyword);
way=request.getParameter("way");
strSQL="";
//////////////书名********************
if(way.trim().equals("1")){
strSQL="SELECT * FROM book where";
strSQL=strSQL+" name like '%"+keyword+"%'";
}
//////////////作者********************
if(way.trim().equals("2")){
strSQL="SELECT * FROM book where";
strSQL=strSQL+" author like '%"+keyword+"%'";
}
//////////////出版社********************
if(way.trim().equals("3")){
strSQL="SELECT * FROM book where";
strSQL=strSQL+" publish_name like '%"+keyword+"%'";
}
//out.println(strSQL);// out.println("<ul>");
ResultSet RSa = workM.executeQuery(strSQL);
int searchnum;
searchnum=0;
while (RSa.next()) {
String srch_title,author;
int id,cate;
id=RSa.getInt("id");
srch_title=getStr(RSa.getString("name"));
author=getStr(RSa.getString("author"));
cate=RSa.getInt("category");
out.println("<tr height='23'><td>");
out.println("<li><a href=javascript:show('../book_store/book.jsp?id="+id+"','详细资料',480,500)>"+srch_title+"</a>");
out.println("</td>");
out.println("<td>"+author+" </td>");
out.println("<td>"+category(cate)+"</td>");
out.println("<td><a href=javascript:show('../book_store/book.jsp?id="+id+"','详细资料',480,500)>[详细资料]</a></td>");
out.println("</tr>");
searchnum=searchnum+1;
}
RSa.close();
out.println("</ul>");
out.println("共搜索到<b><font color=Red>"+searchnum+"</font></b>条纪录");
%>
<p align="right"><a href="javascript:history.go(-1)">返 回</a></p>
</td>
<td width="5%"></td>
</tr>
</table> </td>
</tr>
</table>
<%@ include file="../member/footer.inc"%>