首页 > 解决方案 > 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>

标签: javahtmljsp

解决方案


推荐阅读