Coldfusion 8触发后台页面什么方法最好?

发布于 2024-08-08 20:16:50 字数 190 浏览 3 评论 0原文

我需要触发一个页面开始运行,而不干扰客户端的进程。

我正在上传一个巨大的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

柠檬 2024-08-15 20:16:50

我们有一个根据用户输入创建 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.

往日 2024-08-15 20:16:50

我通常通过将表单发布到 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.

-残月青衣踏尘吟 2024-08-15 20:16:50

如果您尝试对用户上传的文件运行某种用户不关心的任务,您可以使用 使用 SendGatewayMessage 函数进行异步网关调用。但这对您上传文件时没有帮助。正如所指出的,通过 AJAX 上传充其量只是一种 hack,通过 flash 或 java 解决方案可以更好地完成。

ColdFusion CFML 事件网关让
CFML 代码向 CFC 发送消息
异步方法。本次活动
网关让您启动处理
通过 CFC 方法,无需等待
完成或返回一个值。

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.

The ColdFusion CFML event gateway lets
CFML code send a message to CFC
methods asynchronously. This event
gateway lets you initiate processing
by a CFC method without waiting for it
to complete or return a value.

萌面超妹 2024-08-15 20:16:50

我确实找到了一种方法来做到这一点....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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文