救命

TLL_kdtx 2006-02-24 10:18:45
jsp的内容:<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.sql.*" %>
<%@ page import="conn.DBConnection" %>
<html>
<head>
<title>
connection
</title>
</head>
<body bgcolor="#ffffff">
<h1>
JBuilder Generated JSP
</h1>
<%
try{
ResultSet rs = DBConnection.getResultSet();
while(rs.next())
{%>
111111111111111111111111
first:<%=rs.getString(1)%>
<br><br>
second:<%=rs.getString(2) %>
<% }
rs.close();
}catch(Exception ex){

ex.printStackTrace();}

%>

</body>
</html>
Bean的内容:
package conn;
import java.sql.*;
public class DBConnection {

public DBConnection() {}
public static ResultSet getResultSet(){
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url = "jdbc:microsoft.sqlserver://localhost:1433;DatabaseName=TLL";
String user = "sa";
String password = "";
Connection conn =DriverManager.getConnection(url,user,password);
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql = "select * from users";
ResultSet rs = stmt.executeQuery(sql);
return rs;
}catch(Exception ex){
ex.printStackTrace();
return null;
}
}
}
我用JBUILDER编译在TOMCAT5.0下加载 JSP 显示不了 first:<%=rs.getString(1)%>

这些内容 second:<%=rs.getString(2) %>
出现的错误HTTP Status 500 -

--------------------------------------------------------------------------------

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

No Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:128)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:413)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
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.


--------------------------------------------------------------------------------

...全文
65 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
TLL_kdtx 2006-02-24
在我不离不弃的努力下 调试好了

回复
itzhiren 2006-02-24
学习,这跟环境变量设置有关系吗?
回复
infowain 2006-02-24
你的环境变量设置有问题,检查一下吧
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2006-02-24 10:18
社区公告
暂无公告