Here's an ajax solution for a progress bar:
http://weblogs.java.net/blog/edburns/archive/2005/05/ajaxian_faces_p.html
https://blueprints.dev.java.net/bpcatalog/ee5/ajax/usingAJAXwithoutJSF.html
Seems like there should be a way to solve this without ajax, though.
Maybe using a meta refresh.
On 2/7/07, Mikael Andersson <[EMAIL PROTECTED]> wrote:
Hi,
I have an action which performs a length operation, I'd like to get the
browser to redisplay the page while the process keeps running on the server.
I wonder how I perform a programmatic forward which in an action method,
which causes the browser to re-render the page while the action method is
still running.
Is there a way of doing this without spawning a new Thread?
I made the following futile attempt :
Managed bean:
public String longishRunningAction(){
try{
NavigationUtil.programmaticForward
("/report/index.xhtml");
}
catch(Exception e){}
doLongishRunningOperation();
return null;
}
Some of the stuff in here were added just to see if the made a difference,
they didn't :)
public class NavigationUtil {
/**
* Force a forward programmatically
*
* @param viewId the viewId to forward to, ex. /report/index.xhtml
* @throws ServletException
* @throws IOException
*/
public static void programmaticForward( final String viewId ) throws
ServletException, IOException{
ExternalContext eCtx =
FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request =
(HttpServletRequest)eCtx.getRequest();
HttpServletResponse response =
(HttpServletResponse)eCtx.getResponse();
RequestDispatcher dispatcher = request.getRequestDispatcher( viewId
);
dispatcher.forward(request,response);
FacesContext.getCurrentInstance().responseComplete();
response.getOutputStream().flush();
response.getOutputStream().close();
}
}