求助:关于jsp文件无法调用Bean的问题,谢谢!
愚弟百思不得其解,请各位大虾相助!!!
usebean.jsp文件置于D:\Tomcat 5.5\webapps\ROOT\目录下
源程序如下:
<%@ page import = "test.TestBean " %>
<jsp:useBean id = "test " class = "test.TestBean ">
</jsp:useBean>
<% test.setString1( "Hello ");
test.setString2( " world ");
%>
<%= test.getString1Value() %>
<br>
<%= test.getString2Value() %>
TestBean.java 置于D:\Tomcat 5.5\webapps\ROOT\WEB-INF\classes\test\目录下
源程序如下:
package test;
public class TestBean{
private String string1 = null;
private String string2 = null;
public TestBean()
{
}
public void setString1(String value)
{
string1 = value;
}
public void setString2(String value)
{
string2 = value;
}
public String getString1Value()
{
return string1;
}
public String getString2Value()
{
return string2;
}
}
Jdk环境已经配置好
Tomcat已经启动
在IE地址栏键入http://localhost:8080/usebean.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: /usebean.jsp(4,0) The value for the useBean class attribute test.TestBean is invalid.
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: /usebean.jsp(4,0) The value for the useBean class attribute test.TestBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compi