在JSP中上载多个文件
如何在JSP中上传多个文件?
我有一个八个问题的列表,我想要每个问题的附件,当我提交表单时,我收到以下错误。 请帮我解决这个问题
"Caused by: java.lang.IllegalArgumentException: Cannot invoke com.usrinfo.form.AssessmentForm.setAttatchment on bean class 'class com.usrinfo.form.AssessmentForm' - argument type mismatch - had objects of type "java.util.ArrayList" but expected signature "org.apace.struts.upload.FormFile"
这是我的输入类型:
<input class="" type='file' style="display:none;" name="attachment" id="file"/>
这是我的行动
action="xxx.do" method="post" enctype="multipart/form-data">
根据消息,Struts正在尝试在您的AssessmentForm
上设置List
,但您的AssessmentForm
类只有setAttachment(FormFile)
。 如果将其更改为List
,Struts将能够设置FormFiles
列表,您可以迭代它来处理它们。