post请求
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
table{
margin: auto;
}
td{
border: 1px solid darkturquoise;
}
</style>
</head>
<body>
<form method="post" action="UserLoginServlet">
<table>
<tr>
<td>
<label for="userName">账号</label>
<input type="text" id="userName" name="userName">
</td>
</tr>
<tr>
<td>
<label for="password">密码</label>
<input type="password" id="password" name="password">
</td>
</tr>
<tr>
<td>
<input type="submit" value="登录">
<input type="reset">
</td>
</tr>
</table>
</form>
</body>
</html>
登录:
查看:
get请求:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
table{
margin: auto;
}
td{
border: 1px solid darkturquoise;
}
</style>
</head>
<body>
<form method="get" action="UserLoginServlet">
<table>
<tr>
<td>
<label for="userName">账号</label>
<input type="text" id="userName" name="userName">
</td>
</tr>
<tr>
<td>
<label for="password">密码</label>
<input type="password" id="password" name="password">
</td>
</tr>
<tr>
<td>
<input type="submit" value="登录">
<input type="reset">
</td>
</tr>
</table>
</form>
</body>
</html>
登录:
查看:
接口报404,都是接口路径有问题,你这个应该是接口定义的是post请求,而且表单提交一般都使用post请求,因为web浏览器会限制get请求不让其传递请求体(body)
接口定义的是post请求还是get,后端说是什么请求,前端就得是什么请求
因为后端定义的接口是get的呀,