好像是找不到Bean的位置,请大家看看 ....
我把MyBean放在Web-Inf\Classes\test\MyBean.class
这是源文件:
<html>
<head>
<title>use JavaBean </title>
</head>
<%@page contentType="text/html; charset=GBK"%>
<jsp:useBean id="MyBean" class="test.MyBean"/>
<body>
<h2>use JavaBean </h2>
<%!
   String str1="use JavaBean ";
   String str2="不是吗?";
%>   
<%
   mybean.setValue(str1);
   str2=mybean.getValue()+str2;
%>
<h3>
  <%=str2%>
</h3>  
</body>
</html>
这是MyBean.java
package test;public class MyBean{
private String str;
private int num;
//初始化
public MyBean(){
str="This is the initial value.";
num=0;
}
//设置str
public void setvalue(String avalue){
str=avalue;
}
//得到str
public String getvalue() {
return str;
}
//设置number
public void setnumber(int Number)
{
        num=Number;
}
//得到number
public int getnumber()
{
return num;
}

}
这是错误信息:
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Compiling 1 source file to C:\Documents and Settings\Administrator\WebApplication1\build\generated\classes
C:\Documents and Settings\Administrator\WebApplication1\build\generated\src\org\apache\jsp\_05_005f01_jsp.java:51: 软件包 test 不存在
      test.MyBean MyBean = null;
          ^
C:\Documents and Settings\Administrator\WebApplication1\build\generated\src\org\apache\jsp\_05_005f01_jsp.java:53: 软件包 test 不存在
        MyBean = (test.MyBean) _jspx_page_context.getAttribute("MyBean", PageContext.PAGE_SCOPE);
C:\Documents and Settings\Administrator\WebApplication1\build\generated\src\org\apache\jsp\_05_005f01_jsp.java:55: 软件包 test 不存在
          MyBean = new test.MyBean();
C:\Documents and Settings\Administrator\WebApplication1\build\generated\src\org\apache\jsp\_05_005f01_jsp.java:64: 找不到符号
符号: 变量 mybean
位置: 类 org.apache.jsp._05_005f01_jsp
   mybean.setValue(str1);
   ^
C:\Documents and Settings\Administrator\WebApplication1\build\generated\src\org\apache\jsp\_05_005f01_jsp.java:65: 找不到符号
符号: 变量 mybean
位置: 类 org.apache.jsp._05_005f01_jsp
   str2=mybean.getValue()+str2;
        ^
5 错误
C:\Documents and Settings\Administrator\WebApplication1\nbproject\build-impl.xml:353: The following error occurred while executing this line:
C:\Documents and Settings\Administrator\WebApplication1\nbproject\build-impl.xml:141: Compile failed; see the compiler error output for details.
生成失败(总时间:1 秒)