主题:上次发贴问了,改了,谢谢大家!可又有个问题
上次的错误是没引进java.lang.*
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*"%>
<%@ page import="java.lang.*%>
<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>
上次的错误是没引进java.lang.*
引入后变成这样了:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /photobook/buildframe.jsp(4,0) Unterminated <%@ page tag
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:170)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:551)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
org.apache.jasper.compiler.Parser.parse(Parser.java:171)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
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 contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*"%>
<%@ page import="java.lang.*%>
<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>
上次的错误是没引进java.lang.*
引入后变成这样了:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /photobook/buildframe.jsp(4,0) Unterminated <%@ page tag
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:170)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:551)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
org.apache.jasper.compiler.Parser.parse(Parser.java:171)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
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.