我想将文件上传到我的Weblogic服务器。我的表格是
<h:form id="manualReplay" enctype="multipart/form-data">
<h:outputText value="UploadFile Here" /> :
<h:panelGroup layout="block" class="output">
<t:inputFileUpload value="#{serviceClass.uploadedFile}"/>
</h:panelGroup>
<h:commandButton id="upload" value="upload" action="upload" />
</h:form>
我的春季网络流程流xml文件
<view-state id="manualReplay" model="serviceClass" >
<transition on="upload" to="manualReplay">
<evaluate expression="serviceClass.submit()"/>
</transition>
</view-state>
我的豆类
private UploadedFile uploadedFile;
public void submit() throws IOException {
String fileName = FilenameUtils.getName(uploadedFile.getName());
String contentType = uploadedFile.getContentType();
byte[] bytes = uploadedFile.getBytes();
}
public UploadedFile getUploadedFile() {
return uploadedFile;
}
public void setUploadedFile(UploadedFile uploadedFile) {
this.uploadedFile = uploadedFile;
}
但是在提交表单时,页面只是重新加载而没有任何错误。 任何我错的想法。 当我删除enctype这工作正常,但只有multipart / form-data正在发生!
答案 0 :(得分:1)
如果您使用的是SWF,那么您需要在配置文件中包含CommonsMultipartResolver:
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="1024" />//Set your file size limit here
</bean>[enter link description here][1]