java文件如下:
package example5;
public class simpleBean{
  private String name=null;
  private int age=0;
  public simpleBean()
  {
  }
  public String getName()
  {
    return name;
  }
  public void setName()
  {
    name="qinjinbo";
  }
}使用javaBean的jsp文件如下(文件名为mybean.jsp):
<html>
<head>
<title>在jsp中使用javabean</title>
<jsp:useBean id="BeanId" class="example5.simpleBean" scope="application"/>
<jsp:setProperty name="BeanId" property="name" value="jinbo"/>
<jsp:setProperty name="BeanId" property="age" value="22"/>
</head>
<body>
姓名:<jsp:getProperty name="BeanId" property="name"/></br>
年龄:<jsp:getProperty name="BeanId" property="age"/>
</body>
</html>改了很长时间都不知道发生的错误在什么地方!错误显示如下
org.apache.jasper.JasperException: /mybean.jsp(4,0) The value for the useBean class attribute example5.simpleBean is invalid.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
谁能告诉我错在哪啊,谢谢...请指点一下啊...一定结帐

解决方案 »

  1.   

    帮你改了一下JAVA代码,我已在Eclipse和tomcate5.0下调试通过
    package example5; 
    public class simpleBean{ 
    private String name=null; 
    private int age=0; 
    public simpleBean() 


    public String getName() 

    return name; 

    public void setName(String tempName) 

    name=tempName; 
    }
    public int getAge() {
    return age;
    }
    public void setAge(int age) {
    this.age = age;

    }
      

  2.   

    看来楼主对GET和SET 方法还不是熟,建议有时间多看看java基础知识。
      

  3.   

     /mybean.jsp(4,0) The value for the useBean class attribute example5.simpleBean is invalid
    属性非法