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

JavaBean的问题
<jsp:useBean   id= "ll "   scope= "page "   class= "bean.Jbean "/>
<%  
      ll.setStaNum(1);
      ll.setEndNum(60);
      l.setLineName(finish);
  %>
<p> <%=ll.getStaNum()%> </p>
</jsp:useBean>

错误:
Generated   servlet   error:
        [javac]   Compiling   1   source   file

F:\Tomcat\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\notepad\test_jsp.java:106:   package   bean   does   not   exist
            bean.Jbean   ll   =   null;
                    ^
An   error   occurred   at   line:   64   in   the   jsp   file:   /notepad/test.jsp

Generated   servlet   error:
F:\Tomcat\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\notepad\test_jsp.java:108:   package   bean   does   not   exist
                ll   =   (bean.Jbean)   pageContext.getAttribute( "ll ",   PageContext.PAGE_SCOPE);
                                    ^
An   error   occurred   at   line:   64   in   the   jsp   file:   /notepad/test.jsp

Generated   servlet   error:
F:\Tomcat\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\notepad\test_jsp.java:111:   package   bean   does   not   exist
                        ll   =   (bean.Jbean)   java.beans.Beans.instantiate(this.getClass().getClassLoader(),   "bean.Jbean ");
                                            ^
3   errors


------解决方案--------------------
bean.Jbean

这个Jbean的class文件要放在 WEB-INF/classes/bean/Jbean.class

也就是放在相对于包的文件夹下面

你看看的WEB-INF/classes/
------解决方案--------------------
把bean代码贴出来
------解决方案--------------------
都贴出来,看的仔细些。。。
------解决方案--------------------

都贴出来