to_zhangwei 发表于 2004-4-12 18:42:35

请教一个问题:cannot resolve symbol

我写了一个bean叫HelloWorld放在主目录的WEB-INF下,通过javac已经可以编译成.class。然后我在主目录中用一个jsp文件,调用他
<jsp:useBean id="circle" class="HelloWorld" scope="page">
</jsp:useBean>
<% circle.setRadius(100);%>
<%=circle.getRadius()%>
结果出现如下错误:
An error occurred at line: 8 in the jsp file: /index.jsp
Generated servlet error:
    Compiling 1 source file
D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\index_jsp.java:43: cannot resolve symbol
symbol : class HelloWorld
location: class org.apache.jsp.index_jsp
      HelloWorld circle = null;
^
An error occurred at line: 8 in the jsp file: /index.jsp
Generated servlet error:
D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\index_jsp.java:45: cannot resolve symbol
symbol : class HelloWorld
location: class org.apache.jsp.index_jsp
      circle = (HelloWorld) pageContext.getAttribute("circle", PageContext.PAGE_SCOPE);
   An error occurred at line: 8 in the jsp file: /index.jsp


请问这是什么原因,如何解决?

minsj 发表于 2004-4-12 22:04:40

HelloWorld.class 应该放在 WEB-INF\classes 目录下
页: [1]
查看完整版本: 请教一个问题:cannot resolve symbol