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?
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.