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

javabean引用的问题
在JSP页面index.jsp用 <jsp:useBean> 引用BEAN的时候,出现了以下问题。

An   error   occurred   at   line:   10   in   the   jsp   file:   /index.jsp
Generated   servlet   error:
JustForTest   cannot   be   resolved   to   a   type


bean的路径:D:\stumis\WEB-INF\classes\JustForTest.class

index.jsp代码:
<%@   page   language= "java "   contentType= "text/html;   charset=ISO-8859-1 "
        pageEncoding= "ISO-8859-1 "%>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN ">
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=ISO-8859-1 ">
<title> Insert   title   here </title>
</head>
<body>
<jsp:useBean   id= "test "   scope= "page "   class= "JustForTest "/>
<%
        out.println(test.getNum());
%>
</body>
</html>


classpath:

.D:\Program   Files\Java\jdk1.5.0\lib\dt.jar;.D:\Program   Files\Java\jdk1.5.0\lib\tools.jar;.D:\apache-tomcat-5.5.20\common\lib\servlet-api.jar;.D:\apache-tomcat-5.5.20\common\lib\jsp-api.jar;.

和bean同一文件夹里的servlet可以正常使用。但不知道为什么无法引用bean。请大家指点一下。先谢!

------解决方案--------------------
JustForTest这个类没有包结构吗

没有包结构 是不能用的