Coldfusion 8触发后台页面什么方法最好?
我需要触发一个页面开始运行,而不干扰客户端的进程。
我正在上传一个巨大的 csv 文件,上传后重定向到 ajax 状态页面...
但是我如何触发执行页面而不向最终用户显示该页面...我不想要让他们看到...
我可以使用 cfschedule 安排任务立即发生,而不影响客户端/最终用户的性能吗?
谢谢。
I need to trigger a page to start acting, without interfering with client's processes.
I am doing a huge csv file upload, and after upload, redirect to an ajax status page....
But how do i trigger a page to be executed without showing that page to the end user...which i don't want to have them see...
Can i use cfschedule to schedule an task to happen immediately, without affecting performance of the client/end user?
Thank You.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我们有一个根据用户输入创建 PDF 的系统。我们通过 CFTHREAD 抛出一个新线程来创建 PDF,同时重定向到仪表板页面。只需使用 CFTHREAD 创建一个新线程,并且不将其重新加入到父页面。
您将需要某种方式来通知 AJAX 页面(等)该过程已完成。因为我不知道你在做什么,所以我无法在这方面提供太多帮助。但是,我们在数据库中标记了已完成的 PDF。
We have a system that creates PDFs based on user input. We throw a new thread via CFTHREAD to create the PDF while redirecting to a dashboard page. Simply use CFTHREAD to create a new thread, and do not re-join it to the parent page.
You will need some way to notify the AJAX page (etc.) that the process is finished. Since I don't know what you are doing, I can't be of much help with that part. However, we flagged completed PDFs in the DB.
我通常通过将表单发布到 iFrame 来实现此目的,然后使用 javascript,在 iFrame 处理完成时向父页面报告。您可以直接从 iFrame 访问父页面的整个 DOM(包括调用函数)。
另外,如果您要进行上传,则无法使用标准 AJAX 来完成此操作。发布到 iframe 是正确的方法...只需指定 FORM 标记的 target 属性以匹配 iframe 的 name 属性即可。
I usually do this by posting the form to an iFrame, and then using javascript, report back to the parent page when the iFrame is done processing. You can access the entire DOM (including calling functions) of the parent page directly from the iFrame.
Also, if you're doing an upload, there's no way to do that with standard AJAX. Posting to an iframe is the way to go... Just specify the target attribute of your FORM tag to match the name attribute of your iframe.
如果您尝试对用户上传的文件运行某种用户不关心的任务,您可以使用 使用 SendGatewayMessage 函数进行异步网关调用。但这对您上传文件时没有帮助。正如所指出的,通过 AJAX 上传充其量只是一种 hack,通过 flash 或 java 解决方案可以更好地完成。
If you are trying to run some sort of task on the file uploaded by the user that the user does not care about you could use an asynchronous gateway call with the SendGatewayMessage function. This will not help you while uploading the file though. As was pointed out uploading via AJAX is at best a hack and much better done through a flash or java solution.
我确实找到了一种方法来做到这一点....cfthread,正在阅读本·纳德尔关于 cfthread 的许多文章,是这样的...
cfthread action="run" name="moving_#unique_session_value#"
cfhttp url =“some_url”/cfhttp
/cfthread
这太贴心了,让我可以节省客户端/最终用户的性能...
顺便说一句,谢谢大家...
I did find a way to do this....cfthread, was reading many of ben nadel's articles on cfthread, did it like this...
cfthread action="run" name="moving_#unique_session_value#"
cfhttp url="some_url"/cfhttp
/cfthread
this is so sweet, allowed me to save performance of the client/end user...
Btw thank you all...