Struts2 + jQuery - 定期向客户端发送更新
我正在我的网络应用程序中实现一项功能,以便客户端可以通过输入一些数据并单击提交按钮来生成报告。
问题是报告生成需要大量时间,并且如果用户输入的数据错误,则可能无法生成报告。
完整的报告生成任务有许多子任务,我希望当客户按下提交时,然后在该页面下方我想显示拆分为各种子任务的报告生成任务的状态/进度,例如
- Validating input data ------ Done
- Fetching the data ------ In Progress
and so on,
如何使用 Struts2 实现此目的、jQuery在web层?
任何帮助将不胜感激。
谢谢
I am implementing a functionality in my web app such that a client can generate the report by entering some data and clicking on the submit button.
The problem is that report generation takes lot of time and the report might not generate if the user entered data is wrong.
The complete report generation task has many sub-tasks and I want when the client presses submit then just below that page I want to show the status/progress of the report generation tasks splitted in various sub-tasks like
- Validating input data ------ Done
- Fetching the data ------ In Progress
and so on,
How can I achieve this using Struts2, jQuery in the web layer?
Any help will be greatly appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们也有类似的问题。交易通常需要 20 秒,有时甚至超过一分钟。我们认为会有更简单的解决方案,但我们最终得到了这样的方案,
我们在负载平衡器方面遇到了一些问题。为了使该方案发挥作用,每次重新加载都必须返回到同一服务器。幸运的是,负载均衡器支持基于会话 ID 的粘性路由。
We had a similar problem. The transaction normally takes 20 seconds, sometimes over a minute. We thought there would be easier solutions but we ended up with a scheme like this,
We ran into some problem with the load-balancer. For the scheme to work, every reload must come back to the same server. Fortunately, the load-balancer supports sticky routing based on our session id.
看一下 Struts2 ExecuteAndWait 拦截器。 http://struts.apache.org/2。 x/docs/execute-and-wait-interceptor.html
Take a look at the Struts2 ExecuteAndWait interceptor. http://struts.apache.org/2.x/docs/execute-and-wait-interceptor.html