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?
好吧,我正在尝试制作数据导入模块。在模块中,用户选择带有数据的.txt文件,然后单击上传按钮。我想创建一个Textarea或文本框(我的项目是一个Java EE WebApp),其中webapp显示了使用描述性消息的上传过程的真实进度。我正在考虑(我已经搜索过)多个Ajax请求,以及一个请求的多个Ajax响应(最后一个是无效的,正如我读到的那样),但是,我对这个AJAX的使用感到困惑案件。它是有效的用户点击“上传”,然后,我调用一个AJAX请求,返回导入实际注册表的进度的文本?
I'm thinking to use:
我正在考虑使用:
jQuery 1.6.2 GSon (For ajax)
jQuery 1.6.2 GSon(适用于ajax)
Any suggestion would be appreciated
任何建议将不胜感激
3 个解决方案
#1
0
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(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
jQuery AJAX轮询JSON响应,基于AJAX结果或JSON内容进行处理
#2
0
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.
如何使用处理上传表单的iframe?这样就不需要浏览器更新(通过AJAX调用)“我们已经离开”的页面内容。可以设置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. Below is a barebones pseudo-example.
AJAX调用一些方法,一直关注一些进度变量(假设一个表示百分比的双精度)是完全有效的。下面是一个准确的伪示例。
!PSEUDO!
double progress = 0.0d
void upload(request, response) {
// updates progress real-time
}
void ajaxProgress(request, response) {
// set progress to response
}
#3
0
You may want to consider all the traffic back and forth showing real time processing information of uploaded files.
您可能需要反复考虑所有流量来显示上传文件的实时处理信息。
#1
0
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(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
jQuery AJAX轮询JSON响应,基于AJAX结果或JSON内容进行处理
#2
0
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.
如何使用处理上传表单的iframe?这样就不需要浏览器更新(通过AJAX调用)“我们已经离开”的页面内容。可以设置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. Below is a barebones pseudo-example.
AJAX调用一些方法,一直关注一些进度变量(假设一个表示百分比的双精度)是完全有效的。下面是一个准确的伪示例。
!PSEUDO!
double progress = 0.0d
void upload(request, response) {
// updates progress real-time
}
void ajaxProgress(request, response) {
// set progress to response
}
#3
0
You may want to consider all the traffic back and forth showing real time processing information of uploaded files.
您可能需要反复考虑所有流量来显示上传文件的实时处理信息。