Hi,
had it been solely up to me I would have pimped the page with ajax4jsf a
while ago :) .

On 09/02/07, Ricardo Tercero Lozano <[EMAIL PROTECTED]> wrote:


Try AjaxAnywhere (http://ajaxanywhere.sourceforge.net/). Although it's an
Ajax solution, the principal advantage is than this component hadly adds
complexity to your page.

I've used AjaxAnywhere for a similar functionality with success.

Ricardo.




On 2/9/07, Mikael Andersson < [EMAIL PROTECTED]> wrote:
>
> The browser keeps waiting for the action method to finish (when
> submitting), that is why I thought it might be possible to force a
> redirect/forward programmatically so the action could do its length
> computation and the progress page could be redisplayed (without starting a
> new thread).
>
> - mike
>
> On 08/02/07, Mike Kienenberger < [EMAIL PROTECTED]> wrote:
> >
> > If it were me, I'd look at having a meta-refresh tag submit a normal
> > action.
> > The action would check the status of the background process, and
> > either return the "in progress" page again or return the "action
> > completed" page.
> >
> > You shouldn't need to anything strange like try to short-circult the
> > JSF lifecycle or manually construct a response.
> >
> > On 2/8/07, Mikael Andersson < [EMAIL PROTECTED]> wrote:
> > > Looking for some more suggestions :), I would prefer not to use ajax
> > since
> > > it is quite a simple page.
> > >
> > > I have tried some more (hacky) stuff which didn't work either :( :
> > >
> > > The below changed the location URL, but don't load the page?? Any
> > ideas.
> > >
> > > public static void programmaticForward2( final String viewId )
> > throws
> > > IOException{
> > >         FacesContext faces = FacesContext.getCurrentInstance();
> > >         HttpServletResponse response = (HttpServletResponse)
> > > faces.getExternalContext().getResponse();
> > >
> > >         response.setContentType("text/html");
> > >         response.setHeader("Location", "http://localhost:8080/dss "
> > > +viewId);
> > >
> > >         faces.responseComplete();
> > >         response.getOutputStream().flush();
> > >         response.getOutputStream().close();
> > >
> > > }
> > >
> > > The below didn't do anything?
> > >
> > > public static void programmaticForward3( final String viewId )
> > throws
> > > IOException{
> > >         FacesContext faces = FacesContext.getCurrentInstance();
> > >         HttpServletResponse response = (HttpServletResponse)
> > > faces.getExternalContext().getResponse();
> > >         HttpServletRequest request =
> > > (HttpServletRequest)faces.getExternalContext().getRequest();
> > >
> > >         PrintWriter out = response.getWriter();
> > >
> > >         response.setContentType("text/html");
> > >         response.sendRedirect("http://"; +request.getServerName()
> > +":"
> > > +request.getServerPort() +"/dss" +viewId);
> > >
> > >         faces.responseComplete();
> > >         out.flush();
> > >         out.close();
> > >
> > > }
> > >
> > > Cheers,
> > >  Mike no.2
> > >
> > >
> > >
> > > On 07/02/07, Mike Kienenberger < [EMAIL PROTECTED]> wrote:
> > > > 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();
> > > > >
> > > > >     }
> > > > >
> > > > > }
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>

Reply via email to