JSF Portlet Navigation Question - Websphere

This is a discussion on JSF Portlet Navigation Question - Websphere ; Does anyone have an example of JSF navigation in a portlet that does not require a clientaction? I would like to show a loading jsp then forwards automatically to another jsp based on the outcome of method. I have tried ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: JSF Portlet Navigation Question

  1. JSF Portlet Navigation Question

    Does anyone have an example of JSF navigation in a portlet that does not require a clientaction? I would like to show a loading jsp then forwards automatically to another jsp based on the outcome of method. I have tried the follwing already.



    1. Normal jsf navigation is working by including a submit button on my form and a clientaction pointing to a backing bean to trigger the navigation rule.

    2. The PhaseListener with the RESTORE_VIEW approach, but this triggers the navigation before the loading jsp is rendered in the portlet.

    3. NavigationHandler to change the view, but having trouble getting the portlet page to refresh after the that without an exception being thrown. I am also not sure if this is valid approach.



    The key is that I need to run a configuration process that takes some time (5 secs) before the acutal portlet starts. If the process is successful, navigate to the app, if failure, navigate to an error page in the portlet. While the process is running, the loading jsp page should be rendered.



    Any suggestions would be appreciated.



    Thanks!



    Kirk

  2. Re: JSF Portlet Navigation Question

    If you know the amount of time that the pre-processing takes, you can use javascript to wait for that period and fire an onclick event on the submit button.

  3. Re: JSF Portlet Navigation Question

    Hey,



    Thanks for the idea. I will consider it as a workaround solution. It can be difficult to predict how long the processing will take since it is dependent upon load at process time.



    Ideally, this would all happen from the server side so the forward is aware of the end of the processing. Using a client side script to trigger a server side action seems a bit awkward and not really a best practice in this scenario. It would be nice to contain the entire flow on the server side.



    Any other ideas out there?

  4. Re: JSF Portlet Navigation Question

    Did you consider AJAX for making the initial process call and returning the result of the process from server side. Depending on the result forwarding to the next Page(Portlet app page/Portlet Error Page).



    In this case you would still keep the server side procressing and show the loading page.

  5. Re: JSF Portlet Navigation Question

    That makes more sense. At least the the script would be aware of the end-of-processing from the response so the client action could be triggered at the appropriate time. I'll give it a try.



    If anyone has a completely server side approach, I am still interested.



    Thank you.



    Kirk

  6. Re: JSF Portlet Navigation Question

    On Jun 11, 10:47 am, schul...@mpac.ca wrote:
    > Does anyone have an example of JSF navigation in a portlet that does not require a clientaction? I would like to show a loading jsp then forwards automatically to another jsp based on the outcome of method. I have tried the follwing already.
    >
    > 1. Normal jsf navigation is working by including a submit button on my form and a clientaction pointing to a backing bean to trigger the navigation rule.
    >
    > 2. The PhaseListener with the RESTORE_VIEW approach, but this triggers the navigation before the loading jsp is rendered in the portlet.
    >
    > 3. NavigationHandler to change the view, but having trouble getting the portlet page to refresh after the that without an exception being thrown. I am also not sure if this is valid approach.
    >
    > The key is that I need to run a configuration process that takes some time (5 secs) before the acutal portlet starts. If the process is successful, navigate to the app, if failure, navigate to an error page in the portlet. While the process is running, the loading jsp page should be rendered.
    >
    > Any suggestions would be appreciated.


    I've used a server-side redirect once the processing is complete.
    It's kludgy but it works. You can use the WPS URL generation
    techniques to construct a URL to take you to any page with a unique
    name even pass render or action parameters to a named portlet on that
    page.

    Read this for more information on advanced URL generation techniques:
    http://www.ibm.com/developerworks/we...0612_behl.html

    HttpServletRequest request = (HttpServletRequest)
    facesContext.getExternalContext().getRequest();
    HttpServletResponse response = (HttpServletResponse)
    facesContext.getExternalContext().getResponse();
    StateManagerService stateService =
    getServiceHome().getPortalStateManagerService(requ est, response);
    /* createPageURL() is my method */
    EngineURL engineurl = createPageURL(stateService, MY_PORTAL_PAGE,
    null, "");
    String redirectURL = engineurl.toString();
    actionResponse.sendRedirect(redirectURL);
    facesContext.responseComplete();

    Hope this helps,
    Ryan

  7. Re: JSF Portlet Navigation Question

    Sorry for the delay in responding. I was on vacation.



    The AJAX approach to this problem works well. Thanks for the suggestion.



    Kirk

+ Reply to Thread