简体   繁体   English

用户的实时过程进度日志

[英]Real-time Process Progress Logs for the User

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. 用户从模块中选择带有数据的.txt文件,然后单击上载按钮。 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. 我想制作一个Textarea或文本框(我的项目是Java EE WebApp),其中webapp使用描述性消息显示上载过程的实际进度。 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. 我在考虑(并且我已经搜索过)关于多个Ajax请求,以及一个请求的多个Ajax响应(据我所读,最后一个无效),但是,我对此中的AJAX用法感到困惑案件。 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? 用户单击“上传”有效,然后,我调用一个AJAX请求,该请求返回带有实际注册表导入进度的文本?

I'm thinking to use: 我正在考虑使用:

jQuery 1.6.2 GSon (For ajax) jQuery 1.6.2 GSon(对于ajax)

Any suggestion would be appreciated 任何建议将不胜感激

How about using a iframe that handles the upload form? 使用处理上传表单的iframe怎么样? This way it would not require the browser to update (by AJAX calls) the contents of a page that "we're already leaving". 这样,就不需要浏览器更新(通过AJAX调用)“我们已经离开”页面的内容。 The iframe could be styled so that it's indistinguisable from other content. 可以对iframe进行样式设置,使其与其他内容没有区别。

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. AJAX调用某种方法来监视某些进度变量(例如表示百分比的双精度变量)是完全有效的。 Below is a barebones pseudo-example. 以下是准系统伪示例。

!PSEUDO!

double progress = 0.0d

void upload(request, response) {
    // updates progress real-time
}

void ajaxProgress(request, response) {
    // set progress to response
}

I would recommend using JBoss RichFaces 'poll' mechanism for that, or just a simple jquery script on the client side: 我建议为此使用JBoss RichFaces'poll'机制,或者仅在客户端使用简单的jquery脚本:

Ajax Poll Example with RichFaces: http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=poll&skin=blueSky 带有RichFaces的Ajax投票示例: http: //richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=poll&skin= blueSky

JQuery (loads of examples on the web): jQuery(网络上的大量示例):

http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-dynamic-poll-with-jquery-and-php/ 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 jQuery AJAX轮询JSON响应,基于AJAX结果或JSON内容进行处理

您可能需要考虑所有来回显示上载文件实时处理信息的流量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM