struts2文件上传问题
我想上传一个文件并通过显示字符串“成功/失败”来动态更新同一页面上其他 div 中的结果。当我将结果转发到新页面时,它工作正常。然而,对于下面提到的代码,它将 div id“two”更新为 [object HTMLDocument]。请告诉我解决它的方法。
<div id='two' style="border: 1px solid yellow;"><b>initial content</b></div>
<s:form id='theForm2' cssStyle="border: 1px solid green;" enctype="multipart/form-data" action='doUpload' method='post' theme="ajax">
<input type="file" name="upload" />
<s:submit value="GO2" theme="ajax" targets="two"/>
</s:form>
i want to upload a file and update result in other div on the same page dynamically just by showing a string "succeed/failed". It is working fine when i am forwarding result to a new page. However for below mentioned code it is updating div id "two" to [object HTMLDocument]. Please show me the way to solve it.
<div id='two' style="border: 1px solid yellow;"><b>initial content</b></div>
<s:form id='theForm2' cssStyle="border: 1px solid green;" enctype="multipart/form-data" action='doUpload' method='post' theme="ajax">
<input type="file" name="upload" />
<s:submit value="GO2" theme="ajax" targets="two"/>
</s:form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要上传什么类型的文件?
对于 struts.xml 文件中的操作,您需要有一个结果为 type="stream" 的操作
What type of file are you trying to upload?
For your action in your struts.xml file you need to have an action that has a result that is of type="stream"