help1.jsp
<%@ page contentType="text/html; charset=gb2312" import="java.sql.*"%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel=stylesheet href='../treeimg/style.css' type=text/css>
</head>
<body bgcolor="#2F97FF">
<jsp:include page="../inc/top.jsp" flush="true"/>
<form name="form1" method="post" action="help2.jsp">
按作者名搜索:
<input type="text" name="username">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="reset" value="重写">
</form>
</body>
</html>
help2.jsp
<%@ page contentType="text/html; charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="clsIDquery" scope="session" class="org.code.optSql.jdbc"/>
<jsp:useBean id="tools" class="org.code.tool.tools" scope="page" />
<%
//数据库变量声明;
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
String sql=null;
%>
<%!String username,postUser;%>
<%
//数据库连接
conn=clsIDquery.getConn();
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
String username=request.getParameter("username");
sql= "update Content set iBoardID=iBoardID+1 Where postUserName="+username;
rs=stmt.executeQuery(sql);
while(rs.next())
{
String postUser=rs.getString("postUserName");
}
%>
<html>
<body>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1">
<tr bordercolor="#009ACE" bgcolor="#009ACE">
<td width="10%" bgcolor="#9CCFFF">发表作者</td>
</tr>
<td width="10%" bgcolor="#F7FBFF"><%=postUser%></td><!-- ########## -->
</table>
</body>
</html>
<%
//关闭连接
rs.close();
stmt.close();
conn.close();
%>
可页面总是出错
type: Exception report
message
description: The server encountered an internal error () that prevented it from fulfilling this request.
exception:
javax.servlet.ServletException: [Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1。
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.help.help2_jsp._jspService(help2_jsp.java:128)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.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)
root cause :
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1。
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
org.apache.jsp.help.help2_jsp._jspService(help2_jsp.java:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.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)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
大家帮帮忙,多谢了