你的目录结构应该是C:\Apache Tomcat 4.0\webapps\pxl\WEB-INF\classes\test\HelloWorld.class
文件名是HelloWorld.class
在jsp中先import  <%@ page import="test.*" %>
请确认,这样应该是没问题的

解决方案 »

  1.   

    原文件如下
    <%@ page import="test.*" %><%--
     File Name:useBean.jsp
     Author: hewei
     Date: 2002.12.18
    调用:
     Note: use beans to say hello world
    --%>
    <jsp:useBean id="hello" scope="page" class="test.HelloWorld" />
    <jsp:getProperty name="hello" property="Hello" />
    <br>
    <%
    hello.setHello("Are you want to talk to me?");
    %>
    <p></p>
    <%=hello.getHello()%>java:
    package test;public class HelloWorld
    {
    String Hello="hello world, I am hewei!";

    public void HelloWorld()
    {

    }
        
        public void setHello(String name)
        {
         Hello=name;
        }
        public String getHello()
        {
         return Hello;
        }
    }
      

  2.   

    你的属性名要起为首字母为小写的,因为getHello setHello的get set后的第一字母为大写,为了区别你必须这样用。private String hello;
    修改的代码如下,我运行过了,没有问题。
    <jsp:useBean id="hello" scope="page" class="test.HelloWorld" />
    <jsp:getProperty name="hello" property="hello" />
    <br>
    <%
    hello.setHello("Are you want to talk to me?");
    %>
    <p></p>
    <%=hello.getHello()%>package test;public class HelloWorld
    {
    private String hello="hello world, I am hewei!";

    public void HelloWorld()
    {

    }
        
        public void setHello(String name)
        {
         hello=name;
        }
        public String getHello()
        {
         return hello;
        }
    }