急,在线等!jsp+mysql连接报错!
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 134 in the jsp file: /OrganizeProduct.jsp
Generated servlet error:
D:\jakarta-tomcat-5.0.28\work\Catalina\localhost\anine\org\apache\jsp\OrganizeProduct_jsp.java:197: ';' expected
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
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.
代码如下
<%
String na=request.getParameter("bh");
if(na==null)
{na=""; }
String driverName="com.mysql.jdbc.Driver";
String userName="root"; //数据库用户名
String userPasswd="19851017";//密码
String dbName="anine";//数据库名
String tableName="organize";//表名
String url="jdbc:mysql://localhost/"+anine+"?user="+root+"&password="+19851017; //联结字符串
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection=DriverManager.getConnection(url);
Statement statement = connection.createStatement();
try {
ResultSet rs=statement.executeQuery("SELECT * FROM organize WHERE Item_no = '"+na+"'")
while(rs.next())
{
String Item_no1=rs.getString(1);
String Type=rs.getString(2);
String Available_color=rs.getString(3);
String Product_info1=rs.getString(4);
ResultSetMetaData rmeta = rs.getMetaData();//获得数据结果集合
int numColumns=rmeta.getColumnCount();
%>
。。。。。。。。
<%
}
rs.close();
statement.close();connection.close();
}
catch(SQLException event)
{ }
%>