楼主正在找人帮我看呢,你帮我看看,我调试上面的一个例子,是sql2000的那个代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<%@ Page import="java.sql.*"%>
<html>
<head>
<title>无标题文档</title>
</head>
<body>
<%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver:XING-AE809AD14D;DataaseName=sql";//我的数据库的名字和表名都对的
String user="sa";String password="";
Connection conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement();
String sql="select * from student";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){%>
第一个字节内容为:<%=rs.getString(1)%>
第二个字节内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库连接成功");%>
<%rs.close();
stmt.close();
con.close();
%>
</body>
</html>
显示结果如下:
org.apache.jasper.compiler.ParseException: D:\Tomcat 6.0\jakarta-tomcat\webapps\myapp\sjk.jsp(1,4) Invalid directive
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:186)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1070)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1035)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1031)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:453)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:424)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:152)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:164)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:309)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:382)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:387)
at org.apache.tomcat.core.Handler.service(Handler.java:263)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:371)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:786)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:732)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:595)
我都不知道是哪错了,我是新学JSP的