Servlet:
@WebServlet("/user/index")
public class UserController extends HttpServlet {
……
}
Jsp:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<form action="./index" enctype="multipart/form-data" method="post">
<input type="hidden" name="action" value="${action}">
<input type="hidden" name="id" value="${user.id}">
<input type="hidden" name="oldPic1" value="${user.picture}">
<input type="hidden" name="oldPic2" value="${user.picture2}">
登入名称<input type="text" name="loginName" value="${user.id}" ><br>
登入密码<input type="text" name="loginPwd" value="${user.loginPwd}" ><br>
用户姓名<input type="text" name="userName" value="${user.name}"><br>
用户照片1<input type="file" name="picture"><br>
用户照片2<input type="file" name="picture2"><br>
<input type="submit" value="保存">
</form>
</body>
</html>
从jsp跳转到servlet是链接是http://localhost:8080/user/
显示404错误:
HTTP ERROR 404
Problem accessing /user/. Reason:
Not Found
没有跳转到http://localhost:8080/user/index
= =。。。