还是javaBean的问题,答对加分谢谢

any_cold 2002-04-17 01:37:45
我运行了JSP文件调用了一个javaBean
源程序如下:
<html>
<body>
<jsp:useBean id="counterBean" scope="session" class="count.CounterBean" />
<jsp:setProperty name="counterBean" property="count" value="10" />
count值:
<jsp:getProperty name="counterBean" property="count" /><BR>
</body>
</html>


package count;

import java.io.Serializable;

public class CounterBean implements java.io.Serializable
{
int count=0;
public CounterBean(){}
public int getCount() { count++;return count;}
public void setCount(int c) { count=c; }
}

可是运行的时候出现下面的错误(用的是Tomcat)
exception

org.apache.jasper.JasperException: count.CounterBean
at org.apache.jasper.compiler.BeanRepository.getBeanType(BeanRepository.java:183)
at org.apache.jasper.compiler.GetPropertyGenerator.generate(GetPropertyGenerator.java:102)
at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(JspParseEventListener.java:831)
at org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventListener.java:241)
at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:197)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:215)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:546)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:536)




不知道是什么原因,请指教,谢谢.
...全文
6 点赞 收藏 7
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
scarab 2002-04-17
我也不太清楚
呵呵
回复
any_cold 2002-04-17
scarab:谢谢你通过了,我还想请问你为什么不能省去Package,而把Bean直接放在classes目录下
回复
xmvigour 2002-04-17
把bean放在D:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\count下看看。重新启动一下服务

同意scarab(没有尾巴的鲨鱼) 的说法!!!


package count;
public class CounterBean
所以必须是count\CounterBean.class
回复
scarab 2002-04-17
把bean放在D:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\count下看看。重新启动一下服务
回复
scarab 2002-04-17
把bean放在D:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\count下看看。重新启动一下服务
回复
any_cold 2002-04-17
我的bean放在D:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes
jsp文件放在D:\Program Files\Apache Tomcat 4.0\webapps\examples\jsp中
回复
scarab 2002-04-17
你的BEAN放在哪儿了呢?

我的怎么没有问题呢
程序肯定没有问题,我都调试通过了
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告