关于问题:The value for the useBean class attribute test.textcounter is invalid.

kangsg219 2007-03-06 11:01:03
jsp初学者,我实在找不出错在哪。请牛人指点!!


pe Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /textcounter.jsp(9,0) The value for the useBean class attribute test.textcounter is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1155)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Generator.generate(Generator.java:3394)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:210)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
...全文
643 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
真的很小奚 2007-03-07
  • 打赏
  • 举报
回复
LZ程序文件在那无所谓的 要得就是CLASS文件。恭喜LZ问题解决
jjoohhnn13 2007-03-06
  • 打赏
  • 举报
回复
test/count目录下 textcounter.java 和textcounter.class
---------------------------------------------------------
你的JAVABEAN是放在 test/count目录下的
而你的调用JAVABEAN这样写<jsp:useBean id="textcounter" class="test.textcounter" scope="application" />当然找不到textcounter

把class="test.textcounter" 改成 class="test.count.textcounter"
真的很小奚 2007-03-06
  • 打赏
  • 举报
回复
确认你的textcounter类放在什么地方了在 写<jsp:useBean id="textcounter" class="test.count.textcounter" scope="application" />class=""里面要能找到textcounter。CLASS文件
真的很小奚 2007-03-06
  • 打赏
  • 举报
回复
class="test.textcounter"下面有textcounter类吗??你是package count;呀
<jsp:useBean id="textcounter" class="test.count.textcounter" scope="application" />
kangsg219 2007-03-06
  • 打赏
  • 举报
回复
IE中输入http://localhost:8080/test/textcounter.jsp,出现上面的问题,
我感觉代码没有问题,是不是文件的存放路径有问题?还是缺什么支持?
kangsg219 2007-03-06
  • 打赏
  • 举报
回复
test/count目录下 textcounter.java 和textcounter.class
package count;
import java.io.*;
public class textcounter
{ String currentrecord="";
BufferedReader bfr;
public String readfile (String path ,String files) throws FileNotFoundException
{ this.bfr=new BufferedReader (new FileReader(path+"\\"+files));
String returnstr="";
try{currentrecord=this.bfr.readLine();}
catch(IOException e ){e.printStackTrace();}
if(currentrecord==null)
{returnstr="0";}
else
{returnstr=currentrecord;}
return returnstr;
}
public void writefile(String path,String files,String counter) throws FileNotFoundException
{ int writestr=Integer.parseInt(counter)+1;
try{
PrintWriter pw=new PrintWriter(new FileOutputStream(path+"\\"+files));
pw.println(writestr);
pw.close(); }
catch(IOException e){throw new FileNotFoundException(e.getMessage());}
}
}
kangsg219 2007-03-06
  • 打赏
  • 举报
回复
我用的是tomcat6 .
test目录下textcounter.jsp
<%@ page contentType="text/html;charset=GBK" language="java" %>
<html>
<head>
<title>文本在线计数器示例</title>
</head>
<body>
<center>
<h3>文本在线计数器示例<h3>
<jsp:useBean id="textcounter" class="test.textcounter" scope="application" />
<%
string path=application.getRealPath(this.getServletName());
path=path.substring(0,path.lastIndexOf("\\"));
string counter=textcounter.readfile(path,"counter.txt");
textcounter.writerfile(path,"counter.txt",counter);
counter=textcounter.readfile(path,"counter.txt");
%>
<p>您是第<%=counter%>位访问者</p>
</center>
</body>
</html>
kangsg219 2007-03-06
  • 打赏
  • 举报
回复
问题解决了,是class文件的路径问题。
kangsg219 2007-03-06
  • 打赏
  • 举报
回复
给位说的对啊,可是改了后还是有错:
ption report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /textcounter.jsp(9,0) The value for the useBean class attribute test.count.textcounter is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1155)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Generator.generate(Generator.java:3394)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:210)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
【电能质量扰动】基于ML和DWT的电能质量扰动分类方法研究(Matlab实现)内容概要:本文研究了基于机器学习(ML)和离散小波变换(DWT)的电能质量扰动分类方法,并提供了Matlab实现代码。首先利用DWT对电能质量信号进行特征提取,有效捕捉电压暂降、暂升、中断、谐波、闪变等常见扰动的时频特性;随后结合多种机器学习分类器(如SVM、BP神经网络、随机森林等)对提取的特征进行训练与分类,构建高效的扰动识别模型。文中详细阐述了信号预处理、特征工程、模型训练与评估的全过程,验证了该方法在多类扰动识别中的准确性与鲁棒性。; 适合人群:具备一定信号处理和机器学习基础知识,从事电力系统、电气工程及相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①用于电能质量监测系统中对异常信号的自动识别与分类;②为智能电网中的故障诊断与电能质量管理提供技术支持;③作为Matlab仿真实践案例,帮助理解DWT在信号分析中的应用及ML分类器的实现流程。; 阅读建议:建议结合Matlab代码同步运行与调试,深入理解DWT分解过程及特征提取方法,同时可尝试更换不同分类器或优化参数以提升分类性能,进一步拓展至实际数据的应用验证。

81,115

社区成员

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

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