主题:数据库连接时出现的错误,要怎么改啊???
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*"%>
<head>
我的电话本
</head>
<title>
我的web电话本
</title>
<body>
<%
Connection con=null;
Statement sts=null;
ResultSet rs=null;
String nname="";
String nsex="";
String nnumber1="";
String nnumber2="";
request.setCharacterEncoding("GB2312");
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://localhost:3306/web?characterEncoding=GB2312";
con=DriverManager.getConnection(url);
String a="select * from phbook ";
rs=sts.executeQuery(a);
}catch(SQLException sqle){
out.println("sqle="+sqle);}
while(rs.next()){
nname=rs.getString("name");
nsex=rs.getString("sex");
nnumber1=rs.getString("number1");
nnumber2=rs.getString("number2");
%>
<table>
<tr>
<td>name</td>
<td>sex</td><td>number1</td><td>number2</td><td>修改</td><td>删除</td>
</tr>
<%
out.println("<tr>");
out.println("<td>"+nname+"</td>");
out.println("<td>"+nsex+"</td>");
out.println("<td>"+nnumber1+"</td>");
out.println("<td>"+nnumber2+"</td>");
out.println("<td>< A HREF='amend.jsp?'"+rs.getString("name")+">修改</td>");
out.println("<td A href='delete.jsp?'"+getString("name")+">删除</td>");
out.println("</tr>");
}
sts.close();
con.close();
%>
</table>
<a href="new.jsp">新建联系人</A>
错误如下:
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: 44 in the jsp file: /photobook/buildframe.jsp
Generated servlet error:
[javac] Compiling 1 source file
E:\Tomcat 5.0\work\Catalina\localhost\JSPBook\org\apache\jsp\photobook\buildframe_jsp.java:83: cannot resolve symbol
symbol : method getString (java.lang.String)
location: class org.apache.jsp.photobook.buildframe_jsp
out.println("???");
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*"%>
<head>
我的电话本
</head>
<title>
我的web电话本
</title>
<body>
<%
Connection con=null;
Statement sts=null;
ResultSet rs=null;
String nname="";
String nsex="";
String nnumber1="";
String nnumber2="";
request.setCharacterEncoding("GB2312");
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://localhost:3306/web?characterEncoding=GB2312";
con=DriverManager.getConnection(url);
String a="select * from phbook ";
rs=sts.executeQuery(a);
}catch(SQLException sqle){
out.println("sqle="+sqle);}
while(rs.next()){
nname=rs.getString("name");
nsex=rs.getString("sex");
nnumber1=rs.getString("number1");
nnumber2=rs.getString("number2");
%>
<table>
<tr>
<td>name</td>
<td>sex</td><td>number1</td><td>number2</td><td>修改</td><td>删除</td>
</tr>
<%
out.println("<tr>");
out.println("<td>"+nname+"</td>");
out.println("<td>"+nsex+"</td>");
out.println("<td>"+nnumber1+"</td>");
out.println("<td>"+nnumber2+"</td>");
out.println("<td>< A HREF='amend.jsp?'"+rs.getString("name")+">修改</td>");
out.println("<td A href='delete.jsp?'"+getString("name")+">删除</td>");
out.println("</tr>");
}
sts.close();
con.close();
%>
</table>
<a href="new.jsp">新建联系人</A>
错误如下:
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: 44 in the jsp file: /photobook/buildframe.jsp
Generated servlet error:
[javac] Compiling 1 source file
E:\Tomcat 5.0\work\Catalina\localhost\JSPBook\org\apache\jsp\photobook\buildframe_jsp.java:83: cannot resolve symbol
symbol : method getString (java.lang.String)
location: class org.apache.jsp.photobook.buildframe_jsp
out.println("???");
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.