错误: 无法找到以下 bean 的类: testBeanId
index.jsp 为:
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
test
</title>
</head>
<jsp:useBean id="testBeanId" scope="session" class="src.testBean" />
<jsp:setProperty name="testBeanId" property="*" />
<body>
<h1>
Bean Test JSP
</h1>
<form method="post">
<br>Enter new value : <input name="sample"><br>
<br><br>
<input type="submit" name="Submit" value="Submit">
<br>
Value of Bean property is :<jsp:getProperty name="testBeanId" property="sample" />
</form>
</body>
</html>
testBean.java 为:
package src;
public class testBean {
private String sample = "Start value";
public String getSample() {
return sample;
}
public void setSample(String newValue) {
if (newValue!=null) {
sample = newValue;
}
}
}
在WEB-INF 文件夹里有 web.xml 跟 classes 文件夹 ,classes文件夹有src文件夹,里面放testBean.class
我的 web.xml 为:
<?xml version="1.0" standalone='yes'?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>index</servlet-name>
<display-name>index</display-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>index</servlet-name>
<url-pattern>/index</url-pattern>
</servlet-mapping>
</web-app>
这个错误怎么改呢?谢谢