javabean的使用问题

javacountry 2002-03-22 10:14:16

我做了几个javabean,然后用jsp调用, 其它几个javabean都没有什么,总是报classnotfoundexception,何故?
我的javabean都是在jbuilder中编写调试, 最后再用javac进行编译的,我怎么找都找不出问题之所在,请大侠帮忙.
...全文
25 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
javacountry 2002-03-22
  • 打赏
  • 举报
回复
我的bean应该是放对了地方呀,因为我是有几个javabean,都放在一个目录下面,其它的都能够找到的

另外我把javabean 的源码附在下面,请诸位高手指点
package mybeans;
import java.sql.*;
import mybeans.*;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2002
* Company:
* @author
* @version 1.0
*/

public class execdb {
private ResultSet rst;
mybeans.myconnect mydb;
private String statement;
private String boardid;
private String recordid;
private String userid;
private boolean istrue;

public execdb() {
this.rst=null;
mydb=new myconnect();
this.boardid="";
this.recordid="";
istrue=false;
statement="";
}
public void setBoardid(String boardid)
{
this.boardid=boardid;
}

public void setRecordid(String recordid)
{
this.recordid=recordid;
}

public void setUserid(String userid){
this.userid=userid;
}

public String getUserid(){
return this.userid;
}

public String getBoardid(){
return this.boardid;
}

public String getRecordid(){
return this.recordid;
}

public void listit(String xx){
if (xx.equals("board"))
this.rst=mydb.myquery("select * from board") ;
if (xx.equals("record") )
this.rst=mydb.myquery("select * from record where boardid='" +this.boardid+"'");
if (xx.equals("contents"))
this.rst=mydb.myquery("select * from board where userid='"+this.userid+"' " );;
if (xx.equals("users"))
this.rst=mydb.myquery("select * from users ");
}

public boolean next(){
//将resultset前移
try {
if (this.rst.next() )
istrue= true;
else
istrue=false;
}
catch ( SQLException sqlexception) {
System.err.println(sqlexception.getMessage());
}
return istrue;
}

public void delit(String xx, String delid){
if (xx.equals("board"))
this.statement="delete from board where boardid='"+delid+"'";
if (xx.equals("record") )
this.statement="delete from record where recordid='"+delid+"'";
if (xx.equals("users"))
this.statement="delete from users where userid='"+delid+"'";
mydb.myupdate(this.statement );
}

public String getData(String colname)
{
String tempvalue="";
try{
if (this.rst.getString(colname)!=null)
tempvalue=this.rst.getString(colname);
else
tempvalue="";
}
catch(SQLException sqlexception){
System.err.println(sqlexception.getMessage());
}

return tempvalue;
}

public int countit(String recordid){
int countvalue=0;
rst=null;
String vv="select count(*) as aa from record where followid='"+recordid+"'";
try{
rst=mydb.myquery(vv) ;
if (rst.next())
countvalue=rst.getInt("aa");
else
countvalue=0;
}
catch(SQLException sqlexception){
System.err.println(sqlexception.getMessage());
}
return countvalue;
}

public int countit(){
int countvalue=0;
rst=null;
String vv="select count(*) as aa from record where followid='0' and boardid='"+this.boardid+"'";
try{
rst=mydb.myquery(vv) ;
if (rst.next())
countvalue=rst.getInt("aa");
else
countvalue=0;

}
catch(SQLException sqlexception){
System.err.println(sqlexception.getMessage());
}
return countvalue;
}
}
Hikaru 2002-03-22
  • 打赏
  • 举报
回复
总的来说就是你bean没放对地方,jsp找不到。
可以通过设classpath的方法来指定。
或则把bean放到指定的bean目录下面。
wes109 2002-03-22
  • 打赏
  • 举报
回复
自己找一下吧,可能是笔误。好好看一下你的jsp文件
Hikaru 2002-03-22
  • 打赏
  • 举报
回复
你jsp的useBean里面是否写了“mybeans.className”,还有你的bean放在那个目录下,是否加上了package(mybeans)的目录结构?

81,122

社区成员

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

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