日期:2014-05-18  浏览次数:20831 次

100分!这个程序怎么了?晕
以下是bean.jsp的内容!!    
<%@     page     contentType= "text/html;     charset=gb2312 "     language= "java "     %>    
<head>    
<title> 无标题文档 </title>    
</head>    
<jsp:useBean     id= "personInfo "     scope= "page "     class= "Test.Person "     />    
<%personInfo.setName( "阿基米德 ");personInfo.setAge(55);%>                            
<body>    
<h2     align= "center "> 显示javaBean中的信息 </h2>    
<hr>    
<%=personInfo.getName()     %>    
<%=personInfo.getAge()     %>    
</body>    
</html>    
 
以下是Person.java的内容!!    
package     Test;    
public     class     Person    
{    
              private     String     name=null;    
              private     int     age=-1;    
              public     void     setName(String     name)    
              {    
                              this.name     =     name;    
              }    
              public     void     setAge(int     age)    
              {    
                          this.age=age;    
              }    
              public     String     getName()    
              {    
                              return     name;    
              }    
              public     int     getAge()    
              {    
                              return     age;    
              }}    
1.我Tomcat的文件路径:C:\Program     Files\Apache     Software     Foundation\Tomcat     5.5\webapps\myjsp\,其中myjsp是我的jsp文件存放处!    
 
2.我在myjsp下建了一个classes的文件夹!    
 
3.编译用的是javac     -d     .     Person.java命令    
 
4.然后把生成的Test(内含Person.class)放在classes下,运行bean.jsp,产生错误   &nbs