找不到原因
ID是正确的,为什么TheName不正确。
提示:
Cannot find any information on property 'TheName ' in a bean of type 'simplehrsys.UserInfo '
代码:
info.jsp
<%@ page contentType= "text/html; charset=GBK " import= "simplehrsys.* "%>
<%--实例化类--%>
<jsp:useBean id= "User " class= "simplehrsys.UserInfo " scope= "request ">
<%--配置请求参数中的值--%>
<jsp:setProperty name= "User " property= "ID " value= "Hello " />
<jsp:setProperty name= "User " property= "TheName " value= "World " />
</jsp:useBean>
<html>
<head>
<title> 新建网页 1 </title>
</head>
<body>
<form method= "get " name= "myform " action= "info.jsp ">
人员编号: <input type= "text " name= "ID " size= "20 " >
真实姓名: <input type= "text " name= "TheName " size= "20 ">
<%
out.println(User.getID());
out.println(User.getTheName());
%>
<input type= "submit " value= "提交 " name= "B3 ">
<input type= "reset " value= "重置 " name= "B4 ">
</form>
</body>
</html>
UserInfo.java
package simplehrsys;
public class UserInfo {
public UserInfo(){
}
String ID;
String TheName;
public void setID(String id){
this.ID = id;
}
public void setTheName(String theName){
this.TheName = theName;
}
public String getID(){
return ID;
}
public String getTheName(){
return TheName;
}
}
------解决方案--------------------
晕,怎么没有人回答啊
我的也是这个问题
------解决方案--------------------
把javabean重新写一下。
然后再编译。
看起来你似乎把ID和TheName这两个词的大小写改过。