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

jsp调用javabean出错解决办法

2013-09-11 
jsp调用javabean出错firstbean---src---WebRoot--------fbean.jsp---------WEB-INF------classes-------fi

jsp调用javabean出错
firstbean---src
  ---WebRoot
  --------fbean.jsp
  ---------WEB-INF
  ------classes
  -------firstjavabean.class
如果输入http://localhost:8080/firstbean/
可以看到index.jsp的内容
如输入http://localhost:8080/firstbean/fbean.jsp,然后运行出错
   

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: 2 in the jsp file: /fbean.jsp
firstjavabean cannot be resolved to a type
1: <%@ page contentType="text/html;charset=gb2312" %>
2: <jsp:useBean id="fb" scope="session" class="firstjavabean" />
3: <html>
4: <%
5: fb.setfirstproperty("my first");


An error occurred at line: 2 in the jsp file: /fbean.jsp
firstjavabean cannot be resolved to a type
1: <%@ page contentType="text/html;charset=gb2312" %>
2: <jsp:useBean id="fb" scope="session" class="firstjavabean" />
3: <html>
4: <%
5: fb.setfirstproperty("my first");


An error occurred at line: 2 in the jsp file: /fbean.jsp
firstjavabean cannot be resolved to a type
1: <%@ page contentType="text/html;charset=gb2312" %>
2: <jsp:useBean id="fb" scope="session" class="firstjavabean" />
3: <html>
4: <%
5: fb.setfirstproperty("my first");


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


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


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


[解决办法]
<% 
fb.setfirstproperty("my first"); 
% > 
<%=fb.getfirstproperty()% > 
</html > 
改了也用JSP动作看看
[解决办法]
我记的javabean一定要放在一个包里才可以的。 你试试把bean放到一个包里再在jsp页面里去调用试试。。。。
[解决办法]
楼上的是正解。
一般javaBean是需要放到一个包里的。
------
解决的办法:
修改firstjavabean.java,添加在一个包中。
jsp页面调用其相应包名+firstjavabean
[解决办法]
你的<%@ page contentType="text/html;charset=gb2312" % > 
<jsp:useBean id="fb" scope="session" class="firstjavabean" / > 
<html > 
应该改成


<%@ page contentType="text/html;charset=gb2312" % > 
<html>
<jsp:useBean id="fb" scope="session" class="firstjavabean" / > 


[解决办法]
听强人说话!upupup!
[解决办法]
现在断口冲突抱这个错了?

[解决办法]
我狂晕!!
做事细心永不会错。

[解决办法]
是啊
我的异常网推荐解决方案: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

热点排行