用户的实时进程进度日志
好吧,我正在尝试制作一个数据导入模块。从模块中,用户选择包含数据的 .txt 文件,然后单击上传按钮。我想制作一个文本区域或文本框(我的项目是一个 Java EE Web 应用程序),其中 Web 应用程序通过描述性消息显示上传过程的真实进度。 我正在考虑(并且我已经搜索过)多个 Ajax 请求,以及一个请求的多个 Ajax 响应(正如我所读,最后一个无效),但是,我对 AJAX 在此方面的使用感到困惑案件。用户点击“上传”是有效的,然后,我调用一个 AJAX 请求,返回包含实际导入注册表进度的文本?
我想使用:
jQuery 1.6.2 GSon(对于ajax)
任何建议将不胜感激
Well, I'm Trying to Make a Data Importing Module. From the module, the user choose the .txt File with Data and then click the upload button. I want to make a Textarea or textbox (My project is a Java EE WebApp) where the webapp shows the real-progress of the upload proccess with Descriptive Messages.
I'm thinking (And i've searched) about Multiple Ajax Requests, and, Multiple Ajax Responses with one Request (The last one is not valid, as i read), but, i'm confused about the usage of AJAX in this case. It is Valid the user hit "Upload", and then, i call an AJAX Request that returns the text with the progress of the actual registry imported?
I'm thinking to use:
jQuery 1.6.2
GSon (For ajax)
Any suggestion would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议使用 JBoss RichFaces 'poll' 机制,或者只是在客户端使用一个简单的 jquery 脚本:
Ajax Poll Example with RichFaces: http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=poll&skin=blueSky
JQuery(网络上有大量示例):
http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-dynamic-poll-with-jquery-and-php/
jQuery AJAX 轮询 JSON 响应,处理基于AJAX结果或JSON内容
I would recommend using JBoss RichFaces 'poll' mechanism for that, or just a simple jquery script on the client side:
Ajax Poll Example with RichFaces: http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=poll&skin=blueSky
JQuery (loads of examples on the web):
http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-dynamic-poll-with-jquery-and-php/
jQuery AJAX polling for JSON response, handling based on AJAX result or JSON content
使用处理上传表单的 iframe 怎么样?这样就不需要浏览器更新(通过 AJAX 调用)“我们已经离开”的页面内容。 iframe 的样式可以使其与其他内容无法区分。
AJAX 调用某种方法来监视某些进度变量(假设一个表示百分比的双精度值)是完全有效的。下面是一个准系统的伪示例。
How about using a iframe that handles the upload form? This way it would not require the browser to update (by AJAX calls) the contents of a page that "we're already leaving". The iframe could be styled so that it's indistinguisable from other content.
AJAX-calls to a some method that keeps an eye on to some progress-variable (lets say a double that indicates percentage) is perfectly valid. Below is a barebones pseudo-example.
您可能需要考虑显示上传文件的实时处理信息的所有来回流量。
You may want to consider all the traffic back and forth showing real time processing information of uploaded files.