html5沒有獲取到頁面輸入的值,導致頁面輸入的值無法傳到後端。
代碼如下
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>用戶登錄</title>
</head>
<body>
<h1 align="center">用戶登錄</h1>
<form action="/Vcooline/login/doLogin" method="post" enctype="text/plain">
<h3 align="center"> 用戶名: <input type="text" name="userName" size="20" maxlength="50"/></h3>
<h3 align="center"> 密碼: <input type="password" name="password" size="20" maxlength="50"/></h3>
<h3 align="center">
<input type="submit" name="submit" value="登錄"/> <input type="submit" name="submit" value="註冊"/>
</h3>
</form>
<img src="static/images/sex.jpg">
</body>
</html>
什麼原因導致的呢?type標籤在前面,name標籤在後面導致的
<input type="text" name="userName"/>
正確的例子,實現用戶登錄
<form action="/Vcooline/login/doLogin" method="post"/>
*賬號:
<input name="userName" type="text" size="20" maxlength="8"/>
<br> </br>
*密碼:
<input name="password" type="password" size="20" maxlength="8"/>
<br> </br>
<input type="submit" name="submit" value="登錄"/>
<img src="static/images/sex.jpg" width="500" hspace="400" vspace="100">