首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

javabean调用异常

2013-09-11 
javabean调用错误小弟刚学jsp是个新手,在使用javabean是老是报错,请各位大哥帮小弟指点,小弟不胜感激。我的

javabean调用错误
小弟刚学jsp是个新手,在使用javabean是老是报错,请各位大哥帮小弟指点,小弟不胜感激。我的调用页面如下:
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   import= "java.sql.* "   errorPage= " "%>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<jsp:useBean   id= "D "   class= "javabean "   scope= "application "/>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 无标题文档 </title>
</head>

<body>
<jsp:setProperty   name= "D "   property= "* "/>
name:
<jsp:getProperty   name= "D "   property= "name "/>
password:
<jsp:getProperty   name= "D "   property= "password "/>
</body>
</html>
报错页面如下:
HTTP   Status   500   -  

--------------------------------------------

type   Exception   report

message  

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

exception  

org.apache.jasper.JasperException:   Unable   to   compile   class   for   JSP

An   error   occurred   at   line:   4   in   the   jsp   file:   /tt.jsp
Generated   servlet   error:
E:\Tomcat   5.0\work\Catalina\localhost\test\org\apache\jsp\tt_jsp.java:46:   找不到符号
符号:   类   javabean
位置:   类   org.apache.jsp.tt_jsp
            javabean   D   =   null;
            ^


An   error   occurred   at   line:   4   in   the   jsp   file:   /tt.jsp
Generated   servlet   error:
E:\Tomcat   5.0\work\Catalina\localhost\test\org\apache\jsp\tt_jsp.java:48:   找不到符号
符号:   类   javabean
位置:   类   org.apache.jsp.tt_jsp
                D   =   (javabean)   _jspx_page_context.getAttribute( "D ",   PageContext.APPLICATION_SCOPE);
                          ^


An   error   occurred   at   line:   4   in   the   jsp   file:   /tt.jsp
Generated   servlet   error:
E:\Tomcat   5.0\work\Catalina\localhost\test\org\apache\jsp\tt_jsp.java:50:   找不到符号
符号:   类   javabean
位置:   类   org.apache.jsp.tt_jsp
                    D   =   new   javabean();
                                    ^


An   error   occurred   at   line:   13   in   the   jsp   file:   /tt.jsp
Generated   servlet   error:
E:\Tomcat   5.0\work\Catalina\localhost\test\org\apache\jsp\tt_jsp.java:64:   找不到符号
符号:   类   javabean
位置:   类   org.apache.jsp.tt_jsp


            out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((javabean)_jspx_page_context.findAttribute( "D ")).getname())));
                                                                                                                                                ^


An   error   occurred   at   line:   15   in   the   jsp   file:   /tt.jsp
Generated   servlet   error:
E:\Tomcat   5.0\work\Catalina\localhost\test\org\apache\jsp\tt_jsp.java:67:   找不到符号
符号:   类   javabean
位置:   类   org.apache.jsp.tt_jsp
            out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((javabean)_jspx_page_context.findAttribute( "D ")).getpassword())));
                                                                                                                                                ^
5   错误


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.0.28   logs.


--------------------------------------------

Apache   Tomcat/5.0.28


[解决办法]
<jsp:useBean id= "D " class= "javabean " scope= "application "/>
没找到class= "javabean "中的javabean这个bean,这个是需要你的具体的bean的class名字,并且你需要在前面import
[解决办法]
你是用什么开发的JAVABEAN
你那错误提示是没发现JAVABEAN
你自己先把书好好看一下
不过我建议你用MYECLIPSE学JSP
[解决办法]
你最好把你的JAVABEAN代码贴出来
<jsp:useBean id= "D " class= "javabean " scope= "application "/>
class是你JAVABEAN的名字
<jsp:getProperty name= "D " property= "password "/>
得到你javabean中的属性值,你在前面import 一下。


[解决办法]
你加一个包试试
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html

热点排行