开发者

Struts help needed

开发者 https://www.devze.com 2022-12-09 15:12 出处:网络
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

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));
}
// Norm开发者_JAVA技巧al 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消