linkeca
发贴: 15
积分: 0
|
于 2005-10-26 17:00
查询书目程序: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%@ page import="java.sql.*" contentType="text/html;charset=GB2312" %> <jsp:useBean id="pool" scope="session" class="text.check"/> <%request.setCharacterEncoding("gb2312");%> <html> <head> <title>查询结果</title> </head> <body> <% ResultSet rs1,rs2; String search_str,sql1,temp,choice;
String SearchType=request.getParameter("SearchType"); //int i=stringToInt(SearchType); int i=1; choice=request.getParameter("match_flag"); search_str=request.getParameter("search_str");
//SearchType=request.getParameter("SearchType"); Integer p=Integer.valueOf(SearchType); i=p.intValue(); if(choice=="0") temp=search_str+"%"; else temp="%"+search_str+"%"; String str1; switch { case 1://书名; sql1="select * from book_msg where book_name like '"+temp+"'"; break; case 2://作者 sql1="select * from book_msg where book_author like '"+temp+"'"; break; case 3://出版社 sql1="select * from book_msg where book_publisher like '"+temp+"'"; break; case 4://分类号 sql1="select * from book_msg where book_type like '"+temp+"'"; break; default: sql1="select * from book_msg"; } pool.getSQL(sql1); rs1=pool.buildlink(); %> <table border="1"> <tr> <td>图书编号</td> <td>图书名</td> <td>图书状态</td> <td>作者</td> <td>出版社</td> <td>还书时间</td> </tr> <% while(rs1.next()) { %><tr><% %><td><%=rs1.getString("book_id")%> </td><% %><td><%=rs1.getString("book_name")%> </td><% if(rs1.getInt("book_state")==1) %><td>借出 </td><% else %><td>在馆 </td><% %><td><%=rs1.getString("book_author")%> </td><% %><td><%=rs1.getString("book_publisher")%> </td><% %><td><%=rs1.getString("book_returntime")%> </td><% %></tr><% } %></table><% %> </body> </html>
出错信息: type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758) org.apache.jsp.shumuchaxun.forsearch_jsp._jspService(forsearch_jsp.java:167) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.Http
Servlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
|