Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File upload 类型部件的方法getSubmittedFileName()未定义 我试图在servlet 3.0>中上载多个文件。这是我的代码。我在getSubmittedFileName()方法中遇到错误。不知道为什么。救命!! 受保护的void doPost(HttpServletRequest请求, HttpServletResponse响应)引发ServletException,IOException{ String description=request.getParameter(“description”);//检索 // Part filePart=request.getPart(“文件”);//检索 字符串文件名=路径.get(filePart.getSubmittedFileName()) .getFileName().toString();//MSIE修复程序。 InputStream fileContent=filePart.getInputStream(); //…(在这里做你的工作) }_File Upload_Servlet 3.0 - Fatal编程技术网

File upload 类型部件的方法getSubmittedFileName()未定义 我试图在servlet 3.0>中上载多个文件。这是我的代码。我在getSubmittedFileName()方法中遇到错误。不知道为什么。救命!! 受保护的void doPost(HttpServletRequest请求, HttpServletResponse响应)引发ServletException,IOException{ String description=request.getParameter(“description”);//检索 // Part filePart=request.getPart(“文件”);//检索 字符串文件名=路径.get(filePart.getSubmittedFileName()) .getFileName().toString();//MSIE修复程序。 InputStream fileContent=filePart.getInputStream(); //…(在这里做你的工作) }

File upload 类型部件的方法getSubmittedFileName()未定义 我试图在servlet 3.0>中上载多个文件。这是我的代码。我在getSubmittedFileName()方法中遇到错误。不知道为什么。救命!! 受保护的void doPost(HttpServletRequest请求, HttpServletResponse响应)引发ServletException,IOException{ String description=request.getParameter(“description”);//检索 // Part filePart=request.getPart(“文件”);//检索 字符串文件名=路径.get(filePart.getSubmittedFileName()) .getFileName().toString();//MSIE修复程序。 InputStream fileContent=filePart.getInputStream(); //…(在这里做你的工作) },file-upload,servlet-3.0,File Upload,Servlet 3.0,我以前遇到过这个问题。 有人帮我找到了这个问题的根源,所以我得到了以下解决方案: 在JavaEE7的文档中,您可以看到自Servlet 3.1以来,“接口部分”已经添加到它的getSubmittedFileName方法中,并且从tomcat网站上可以看到tomcat 7实现了Servlet 3.0,因此我需要从tomcat 7升级到tomcat 8.0.x 参考资料: 如果使用Servlet 3.0,则必须手动定义getSubmittedFileName() 当您还没有使用Servlet

我以前遇到过这个问题。 有人帮我找到了这个问题的根源,所以我得到了以下解决方案:

在JavaEE7的文档中,您可以看到自Servlet 3.1以来,“接口部分”已经添加到它的getSubmittedFileName方法中,并且从tomcat网站上可以看到tomcat 7实现了Servlet 3.0,因此我需要从tomcat 7升级到tomcat 8.0.x

参考资料:


如果使用Servlet 3.0,则必须手动定义
getSubmittedFileName()


当您还没有使用Servlet 3.1时,请向下滚动到“,手动获取方法定义的提交文件名”,并根据您的需要进行更改。

这里也有相同的问题。最后,我可以找到解决方案,更改您的tomcat服务器,反之亦然。您可以解决此问题。我有tomcat 8,使用java 8是否更改了您的项目“有针对性的运行时”:嗯,好的,当你再次谈到这个问题时,我们可以再次开始对它进行故障排除。servlet 3.1不被Tomcat 8使用。这些天我在一家公司担任android开发人员。所以我对安卓非常感兴趣
protected void doPost(HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    String description = request.getParameter("description"); // Retrieves
                                                                // <input
                                                                // type="text"
                                                                // name="description">
    Part filePart = request.getPart("file"); // Retrieves <input type="file"
                                                // name="file">
    String fileName = Paths.get(filePart.getSubmittedFileName())
            .getFileName().toString(); // MSIE fix.
    InputStream fileContent = filePart.getInputStream();
    // ... (do your job here)
}