为了账号安全,请及时绑定邮箱和手机立即绑定

<jsp:setProperty name="myUsers" property="psssword" param="mypass"/>运行后报错 Cannot find any information on property [psssword] in a bean of type [com.po.Users]

dologin.jsp页面

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"

    pageEncoding="utf-8"%>

<!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=utf-8">

<title>Insert title here</title>

</head>

<body>

<h1>setProperty动作元素</h1>

<jsp:useBean id="myUsers" class="com.po.Users" scope="application"/>

<hr>

<!-- 根据表单自动匹配所有属性 -->

<%-- 

<jsp:setProperty name="myUsers" property="*"/>

--%>

<!-- 根据表单自动匹配部分属性 -->

<%-- 

<jsp:setProperty name="myUsers" property="username"/>

--%>

<!-- 跟表单无关,通过手工赋值给属性 -->

<%-- 

<jsp:setProperty name="myUsers" property="username" value="lisi"/>

<jsp:setProperty name="myUsers" property="password" value="88888888"/>

--%>

<!-- 通过URL传参数给属性赋值 -->


<jsp:setProperty  name="myUsers" property="username" />

<jsp:setProperty  name="myUsers" property="psssword" param="mypass"/>


<!-- 使用传统的表达式方式来获取用户名和密码 -->

<%--

用户名:<%=myUsers.getUsername() %><br>

密码:<%=myUsers.getPassword() %><br>

--%>

<!-- 通过getProperter方式传参数来获取用户名和密码 -->

用户名:<jsp:getProperty property="username" name="myUsers"/><br>

密码:<jsp:getProperty property="password" name="myUsers"/><br>

</body>

</html>

login.jsp页面

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>

<!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=utf-8">

<title>Insert title here</title>

</head>

<body>

<h1>登录系统</h1>

<hr>

<form name="loginForm" action="dologin.jsp?mypass=999999" method="post">

<table>

<tr>

<td>用户名:</td>

<td><input type="text" name="username" value=""/></td>

</tr>

<tr>

<td>密码:</td>

<td><input type="password" name="password" value=""/></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="submit" value="登录"/></td>

</tr>

</table>

</form>

</body>

</html>


正在回答

1 回答

<jsp:setProperty  name="myUsers" property="username" />

<jsp:setProperty  name="myUsers" property="psssword" param="mypass"/>

"psssword"改为"password"单词打错了亲~

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

<jsp:setProperty name="myUsers" property="psssword" param="mypass"/>运行后报错 Cannot find any information on property [psssword] in a bean of type [com.po.Users]

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信