我正在尝试使用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请求的资源不可用。
为什么?
答案 0 :(得分:0)