尝试使用JSF inputFile进行ajax上传
<h:body>
<h:form enctype="multipart/form-data">
<h:inputFile id="file" value="#{uploadController.upfile}">
<f:ajax listener="#{uploadController.handleUpload}" />
</h:inputFile>
</h:form>
</h:body>
当我选择文件时,我的页面会刷新javascript错误
Uncaught TypeError:无法调用undefined jsf.js.xhtml的方法'getAttribute'?ln = javax.faces&amp; stage = Development:2734
使用简单的inputText获取相同的错误
<h:body>
<h:form enctype="multipart/form-data">
<h:inputText id="test" value="#{testController.test}">
<f:ajax />
</h:inputText>
</h:form>
</h:body>
当我删除enctype =“multipart / form-data”
时,它会起作用我的JSF依赖项是
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.4</version>
</dependency>
浏览器Download
加载的Jsf js文件由于