已解決——setproperty的作用問題,為什么注釋了還能起作用,如下代碼,還能獲取到password
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
? ? pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在此處插入標題</title>
</head>
<body>
<jsp:useBean id="myUsers" class="com.po.Users"></jsp:useBean>
?<h1>setProperty動作元素使用方法</h1>
?<hr>
?<!-- 根據(jù)表單自動匹配所有的屬性 -->
?<!--
?//<jsp:setProperty name="myUsers" property="*" ?/>
? -->
? <!-- 根據(jù)表單自動匹配指定部分的屬性 -->
? <jsp:setProperty ?name="myUsers" property="username"/>
?用戶名:<%=myUsers.getUsername() %><br>
?密碼:<%=myUsers.getPassword() %><br>
</body>
</html>
2017-09-02
謝謝,我也碰到這個問題了
2016-11-13
找到問題了,注釋使用的符號不對,應該使用<%-- ?%-->,我使用成了<!-- -->
2016-11-13
獲取用戶名啊。