我用JBuilderX建的javabean,JSP不能调用!@#@¥#%^&#在线等!!!!

hiw 2004-08-05 09:10:16
usercount.jsp:
-------------------
<jsp:useBean id="counter" scope="application" class="test.Counter"/>
<br>
你是第:
<%
out.println(counter.getCount());
counter.addCount();
%>位人
------------------------

Counter.java
------------------------
package test;

/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/

public class Counter {
int Count = 1;

public void Counter() {
}

public void addCount()
{
Count++;
}
public int getCount()
{
return Count;
}
}
---------------------------
用JB建的Javabean工程生成Counter.class后,放到WEB-INF\class\test目录下,但是就是不能用,出现下面错误:
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: 1 in the jsp file: /firstjsp/usercount.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jsp-examples\org\apache\jsp\firstjsp\usercount_jsp.java:40: package test does not exist
test.Counter counter = null;
^



An error occurred at line: 1 in the jsp file: /firstjsp/usercount.jsp

Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jsp-examples\org\apache\jsp\firstjsp\usercount_jsp.java:42: package test does not exist
counter = (test.Counter) pageContext.getAttribute("counter", PageContext.APPLICATION_SCOPE);
^



An error occurred at line: 1 in the jsp file: /firstjsp/usercount.jsp

Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jsp-examples\org\apache\jsp\firstjsp\usercount_jsp.java:44: package test does not exist
counter = new test.Counter();
^
3 errors


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
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.

大家知道的,帮忙啊,在线急急等
...全文
88 点赞 收藏 11
写回复
11 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
一点晴 2004-08-07


检查路径。


检查Bean代码:package test;
回复
xwei520 2004-08-05
web.xml贴出来!~
回复
lanlanq 2004-08-05
路径应该是“WEB-INF\classes\test”而不是“WEB-INF\class\test”
回复
hiw 2004-08-05
WEB-INF/classes/下是已经有文件夹test了
里面放Counter.class
但是还是出现这个问题,

有人说是web.xml配置问题
回复
batt 2004-08-05
找不到test包
确ren在WEB-INF/classes/下是否有文件夹test
回复
camel4057 2004-08-05
不对,你的代码错误的部分没有贴出来,请全部贴出来看看
回复
llclovejava 2004-08-05
路径是最基本,最简单,最常见的问题,自己多注意就好了
回复
戚爱斌 2004-08-05
检查一下路径
回复
xwei520 2004-08-05
package test does not exist报错不是说了??
你的Counter这个类放在什么目录下!~
回复
yangzuyu12 2004-08-05
这种问题还是自己多试试吧,加粗classpath之类的方法
回复
ecaol 2004-08-05
UP
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2004-08-05 09:10
社区公告
暂无公告