我在写JSP+javabean时,难道非要我在myeclipse中新建一个包,然后将*.java bean放在里面吗,放在默认中不行吗,感谢
我在写JSP+javabean时,难道非要我在myeclipse中新建一个包,然后将*.java bean放在里面吗,放在默认中不行吗,感谢+
<%@ page language= "java " import= "java.util.* " pageEncoding= "ISO-8859-1 "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<jsp:useBean id= "ghy " scope= "request " class= "abc "/>
<html>
<head>
<body>
<%
out.println(ghy.show());
%>
</body>
</html>
我这样写就是不行,不知道为什么。
public class abc {
public double show() {
return 1.1;
}
}
--------------------
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: /abc.jsp
Generated servlet error:
abc cannot be resolved to a type
An error occurred at line: 4 in the jsp file: /abc.jsp
Generated servlet error:
abc cannot be resolved to a type
An error occurred at line: 4 in the jsp file: /abc.jsp
Generated servlet error:
abc cannot be resolved to a type
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.
JasperException: Unable to compile class for JSP
An error occurred at line: 4 in the jsp file: /abc.jsp
Generated servlet error:
abc cannot be resolved to a type
An error occurred at line: 4 in the jsp file: /abc.jsp
Generated servlet error:
abc cannot be resolved to a type
An error occurred at line: 4 in the jsp file: /abc.jsp
Generated servlet error:
abc cannot be resolved to a type
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)