java - useBean 类属性 [begineerbooks.com.Details] 的值无效。] 根本原因
问题描述
我从几天开始学习 JSP,然后当我运行我的 prog 时,我在 useBrean 遇到了一个问题,控制台显示了这个问题。我看到了很多解决方案,我尝试了所有解决方案,但任何解决方案都没有解决这个问题。所以,我要求大家尽快给我解决方案。
严重:servlet [jsp] 在路径 [/Bean_Example] 的上下文中的 Servlet.service() 引发异常 [/userDetails.jsp (line: [10], column: [0]) useBean 类属性的值 [begineerbooks. com.Details] 无效。] 根本原因 org.apache.jasper.JasperException: /userDetails.jsp (line: [10], column: [0]) useBean 类属性的值 [begineerbooks.com.Details]是无效的。
package begineerbooks.com;
public class Details {
private String name,password;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
接着
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="userDetails.jsp">
Name : <input type= "text" name = "name">
<br>
Password: <input type= "password" name = "password">
<br>
Age: <input type = "text" name = "age">
<br>
<input type = "submit" value = "Submit">
</form>
</body>
</html>
和
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<jsp:useBean id="userinfo" class = " begineerbooks.com.Details"></jsp:useBean>
<jsp:setProperty property="*" name="userinfo"/>
<p>your enry sid here</p>
<jsp:getProperty property="name" name="userinfo"/>
<jsp:getProperty property="password" name="userinfo"/>
<jsp:getProperty property="age" name="userinfo"/>
</body>
</html>
解决方案
推荐阅读
- popup - 我如何在geoserver的传单wms层上实现弹出窗口
- javascript - 在 JSON 对象中递归搜索属性名称 {String} 并返回关联值
- javascript - 尽管已传递到指定路线,但来自 Flask 应用程序的数据未显示在图表中
- sql - T-SQL 重新排列 1...n 中的值
- python-3.x - 如何获得批量图像的 keras 模型预测?
- java - 加入三个深度表时出现“MultipleBagFetchException:无法同时获取多个包”
- html - 具有不同无序列表的多个段落
- python - 如何从类方法传递函数指针
- xcode - 如何在 Xcode 中从 chromium 调试 Skia?
- excel - Excel - 将列中的值分成两列