主题:javaBeans调用出错! 十万火急!!!
jsp文件:
<%@ page language="java" %>
<%@ page import="com.test.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>javaBeans的使用</title>
</head>
<body>
<jsp:useBean id="HW" scope="page" class="com.test.TestBean"/>
<center>
<%
HW.setName("Hello World");
%>
JavaBean name is:<%=HW.getName()%>
</center>
</body>
</html>
TestBean.java文件:
//TestBean.java
//类公有
//TestBean类真的要有一个不带参数的默认的构造函数
//要有setName和getName方法
package com.test;
public class TestBean{
private String name;
public TestBean(){
this.name="";
}
public void setName(String strName_p){
this.name=strName_p;
}
public String getName(){
return this.name;
}
}
报错信息: The value for the useBean class attribute com.test.TestBean is invalid.
本人已把TestBean.class放在WEB-INF/classes/com/test下~!
<%@ page language="java" %>
<%@ page import="com.test.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>javaBeans的使用</title>
</head>
<body>
<jsp:useBean id="HW" scope="page" class="com.test.TestBean"/>
<center>
<%
HW.setName("Hello World");
%>
JavaBean name is:<%=HW.getName()%>
</center>
</body>
</html>
TestBean.java文件:
//TestBean.java
//类公有
//TestBean类真的要有一个不带参数的默认的构造函数
//要有setName和getName方法
package com.test;
public class TestBean{
private String name;
public TestBean(){
this.name="";
}
public void setName(String strName_p){
this.name=strName_p;
}
public String getName(){
return this.name;
}
}
报错信息: The value for the useBean class attribute com.test.TestBean is invalid.
本人已把TestBean.class放在WEB-INF/classes/com/test下~!