使用AJAX同一个页面上Struts2的文件上传成功消息 [英] struts2 file upload success message on same page using ajax
本文介绍了使用AJAX同一个页面上Struts2的文件上传成功消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我上传.csv文件和调整同一页上,我想显示文件上传成功的消息在同一page.I不想使用ajax.I是新的Struts框架我已经发送请求通过大量的文件上传教程走了,但每个人都被重定向到一个不同的页面,并显示信息在那里。
I am uploading .csv file and redirecting on same page,I want to the display file upload successfully message on a same page.I don't want to send the request using ajax.I am new to struts framework I've gone through many file uploading tutorials but everyone is redirecting to a different page and displaying message there.
推荐答案
设置ActionError在你的动作(如文件犯规符合条件)
set ActionError in your action(if file doesnt meet your criteria) using
addActionError("file not uploaded something went wrong");
另有一套动作的消息
otherwise set action message
addActionMessage("Upload successfully completed");
jsp页面。
jsp page.
<body>
<s:actionerror />
<s:actionmessage />
<s:form action="uploadAction" >
<s:file name="filename" />
<s:submit />
<s:form>
</body>
这篇关于使用AJAX同一个页面上Struts2的文件上传成功消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文