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

<jsb:useBean>的问题
我把一本jsp教程光盘里的jsp例子拷到我的tomcat home/webappswebapps/jspDev目录下。该目录包括如下文件:
src\com\Bean\UserInfo.java
WEB-INF\classes\com\Bean\UserInfo.java
WEB-INF\Web.xml

index.jsp(该程序没有问题 内容如下:
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>用户注册</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
 <center>
  <form action="doreg.jsp" method="get">
  <table border="1" style="margin-top:150" width="250">
  <tr height="25" bgcolor="lightgrey">
  <td align="center" colspan="2">用户注册</td>
  </tr>
  <tr>
  <td align="right">用户名:</td>
  <td align="center"><input type="text" name="name" size="29"></td>
  </tr>
  <tr>
  <td align="right">职&nbsp;&nbsp;务:</td>
  <td align="center"><input type="text" name="job" size="29"></td>
  </tr>
  <tr>
  <td align="center" colspan="2">
  <input type="submit" value="注册">
  <input type="reset" value="重置">  
  </td>
  </tr>
  </table>
  </form>
  <br>
 </center>
</body>
</html>


处理上面表单中输入的信息的jsp:
doreg.jsp 内容如下:
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<jsp:useBean id="us" class="com.Bean.UserInfo" scope="request"/>
<jsp:setProperty name="us" property="*"/>
<%
  String name=us.getName();
  String job=us.getJob();
   
  if(name.equals("")||job.equals("")){
%>
  <jsp:forward page="/false.jsp"/>
<% }else{ %>
  <jsp:forward page="/success.jsp"/>
<% } %>

还有
success.jsp
false.jsp

我每次把表单的信息输入后,点注册按钮后,就出现下面的tomcat错误:

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: /doreg.jsp(2,0) The value for the useBean class attribute com.Bean.UserInfo is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1155)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2394)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.vis