我写的一个BEAN,但是有问题~大家帮我!

hsnh1981 2006-02-19 10:43:36
package book;
import java.util.*;
import java.sql.*;

public class book
{
private ResultSet rs = null;
private Statement stmt = null;
private Connection con = null;

public void openDate(String url, String us, String ps)
{
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = DriverManager.getConnection(url, us, ps);
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
}
catch (Exception e)
{
e.printStackTrace();
}
}

public void closeDate()
{
try
{
stmt.close();
con.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}

public ResultSet secrchSql(String sql)
{
try
{
rs = stmt.executeQuery(sql);
}
catch (Exception e)
{
e.printStackTrace();
}
return (rs);
}

public void editSql(String sql)
{
try
{
stmt.executeUpdate(sql);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

解决给分!我确保数据库没问题!
就是这个JAVA文件生成的CLASS文件用JSP连接时错误!我保证CLASS的包和文件的位置对!
问题在这个JAVA程序本身!
...全文
134 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
HengHuan 2006-02-20
  • 打赏
  • 举报
回复
Unable to compile class for JSP
编译出现问题,引用失败

book.book GO = null;
book.book 没有被new出来啊

路过,帮顶——
doway 2006-02-19
  • 打赏
  • 举报
回复
JSP 文件中有非法字符,另外就是前边说的 book.book 太难看了,book.Book 还说得过去。
hsnh1981 2006-02-19
  • 打赏
  • 举报
回复
还有我每次用DW2004打开JSP文件时里面的中文就显示成乱码,怎么回事?
hsnh1981 2006-02-19
  • 打赏
  • 举报
回复
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: 24 in the jsp file: /liuyan/board.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Tomcat 4.1\work\Standalone\localhost\_\liuyan\board_jsp.java:90: illegal character: \65307
sql = "select * from message"锛?
^



An error occurred at line: 24 in the jsp file: /liuyan/board.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\liuyan\board_jsp.java:91: illegal character: \65307
rst = GO.secrchSql(sql)锛? //璋???芥??ヨ??版?搴?
^



An error occurred at line: 24 in the jsp file: /liuyan/board.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\liuyan\board_jsp.java:106: illegal character: \65307
rst = GO.secrchSql(sql)锛? //璋???芥??ヨ??版?搴?
^



An error occurred at line: 10 in the jsp file: /liuyan/board.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\liuyan\board_jsp.java:54: package book does not exist
book.book GO = null;
^



An error occurred at line: 10 in the jsp file: /liuyan/board.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\liuyan\board_jsp.java:56: package book does not exist
GO = (book.book) pageContext.getAttribute("GO", PageContext.REQUEST_SCOPE);
^



An error occurred at line: 10 in the jsp file: /liuyan/board.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\liuyan\board_jsp.java:59: package book does not exist
GO = (book.book) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "book.book");
^



An error occurred at line: 24 in the jsp file: /liuyan/board.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\liuyan\board_jsp.java:84: cannot resolve symbol
symbol : method GO (java.lang.String,java.lang.String,java.lang.String)
location: class org.apache.jsp.board_jsp
GO(url, user, password);
^
7 errors


doway 2006-02-19
  • 打赏
  • 举报
回复
package book;
public class Book { ...

包名和类名不应该相同。
zorro09 2006-02-19
  • 打赏
  • 举报
回复
错误信息打出来

62,624

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧