为什么报错如下:
org.apache.jasper.JasperException: /try.jsp(8,0) The value for the useBean class attribute com.check is invalid我都javabean为:
import java.io.*;
class check 
{ private String name;
  private String password;
   
  public void setname(String name){this.name=name;}
  public String getname(){return this.name;}  public void setpassword(String password){this.password=password;}
  public String getpassword() {return this.password;} public boolean chechright(String name)
{
 if(name=="aaa")
 return true;
 else return false;
 }
}
我的jsp为:
<%@ page contentType="text/html; charset=gb2312" language="java" import="com.*,java.util.*,java.io.*" errorPage="../error.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<jsp:useBean id="check" class="com.check" scope="request"/>
<body>
<%
String name="aaa";
boolean a=check.checkright(name);
out.println(a);
%>
</body>
</html>

解决方案 »

  1.   

    你的check.java中有package com;吗
      

  2.   

    <jsp:useBean id="check" class="com.check" scope="request"/>
    check 类 需要在com包下面
    check类 最好写成 class Check{...}
      

  3.   

    有,我忘粘了
    package com;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
      

  4.   

    你的check.class应该在classes\com\下
      

  5.   

    我放在com下了,以前我也是这么做的,都没有问题,今天不知怎么搞的
      

  6.   

    public class check 
    ======
      

  7.   

    public boolean chechright(String name)
    {
     if(name=="aaa")
     return true;
     else return false;
     }
    不能这样比较吧!
     public boolean chechright(String name)
    {
     if(name.equals("aaa"))
     return true;
     else return false;
     }
      

  8.   

    你的bean也没有在CON包里面呀?
      

  9.   

    不好意思打错了!
    你的bean也没有在com包里面呀?