需要 Struts 帮助
我有一个问题。我需要运行一个查询来从表 t 中获取测试数据。查询当前在操作类中运行。运行需要 20 秒。现在我的问题并不总是 t 会出现value,如果我让用户等待检查 t 是否存在,用户会很恼火。
select t from table
if(t!=null&&!(.equals("")))
{
return (mapping.findForward(result));
}
// Normal flow
最好我总是执行正常流程并在后台运行查询,并在每当我获得 t 的值并返回到 struts 配置中提到的页面时中断。有没有办法做到这一点?
I have an issue.I need to run a query to get a data say test from a table t.The query currently runs in an action class.Its taking 20 seconds to run.Now my problem is not all times t is going to have value and the users will be annoyed if I make them wait to check whether t exists or not.
select t from table
if(t!=null&&!(.equals("")))
{
return (mapping.findForward(result));
}
// Normal flow
It will be good that I always excecute the normal flow and run the query in background and interrupt whenever I get a value for t and return to the page mentioned in struts config.Is there a way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你可以使用 AJAX 来实现这一点。您将以响应到来时完成活动的方式获得代码。即异步。
但有一件事是 Action 总是会等待事情完成。相反,您可以拥有一个表(例如任务表),您可以在其中启动任务并在 Ajax 中检查其状态。
如果您允许用户从页面进行导航,那么我想您的生活将会变得更加困难。
如果您可以像灯箱控件一样禁用屏幕点击,我想这看起来会更不错。
I guess you can use AJAX for this. You will get code in a way that the activity is done when a response come. I.e. asynchronously.
But one thing is that Action will always wait for things to complete. Instead you can have a table (say a tasks table) in which you can start a task and check its status in Ajax.
If you are going to allow the user to navigate from the page then I guess you will make your life more difficult.
If you can disable the screen clicks like in lightbox control, I guess this would look more decent.