我正在尝试使用 Servlet 3.0 /JSP (IDE : Eclipse)发送文件
这是我的 JSP 代码:
<form method="post" action="UploadServlet"
enctype="multipart/form-data">
Select file to upload: <input type="file" name="file" size="60" /><br />
<br /> <input type="submit" value="Upload" />
</form>
还有我的 Servlet:
@WebServlet
@MultipartConfig(fileSizeThreshold = 1024 * 1024 * 2,
maxFileSize = 1024 * 1024 * 10,
maxRequestSize = 1024 * 1024 * 50)
public class UploadServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String SAVE_DIR = "uploadFiles";
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException{
//CODE
}
但是当我提交表单时,我收到一个错误 HTTP 404 请求的资源不可用。
为什么 ?