Fórum

Problem Navigating Between Pages from JSF Portlets

efrain romero, modificado 7 Anos atrás.

Problem Navigating Between Pages from JSF Portlets

New Member Postagens: 6 Data de Entrada: 01/08/16 Postagens Recentes
So i have to very ... interesting issues that perhaps you ppl can help me with.

A bit of background i have 3 different liferay pages. the 1st page has 1 portlet, 2 second has 4 portlets and 3rd has 1 portlet

portal/init
portal/transactional
portal/dostuff

My first issues is navigating between pages. i have my "login" portlet in page one that redirects to page 2. Since its outside of the scope of my WAR i have not being able to uses faces-* rules. So i use the following.


public void redirectUrl(String url,boolean requestContext)
    {
        String outputLink ="/web/portal/" + url ;
        if(requestContext) {
            String fullUrl = "document.location.href='"+outputLink+"';";
            RequestContext.getCurrentInstance().execute(fullUrl);
        }else
        {
            try {
                FacesContext.getCurrentInstance().getExternalContext().redirect(outputLink);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }


Now, this works for the 1ts page (Im using a p:commandButton and the redirect in the actionListener).
For the second page it also works. But it reloads all the portlets on the page, before going to the 3rd page.

i have tried process=@this inmmediate=true no dice.

So my questions.
1- Is there a "proper" way to navigate between pages from a portlet.
2- How can a prevent my current page to be reloaded before going the next page. (this is wastefull since each of my portlets load information thats not going to be displayed and delays the load)

thanks in advance.
thumbnail
Neil Griffin, modificado 7 Anos atrás.

RE: Problem Navigating Between Pages from JSF Portlets

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
We just fixed FACES-1843 which was preventing our com.liferay.faces.demo.jsf.login.portlet.war demo from working properly. It is my best understanding that the login must take place with a full page postback (i.e. p:commandButton ajax="false") and a server-side redirect. Before we attempt to answer your other questions about navigating to different pages, please try the attached war and let us know if it works in your environment. It is designed to be used with Liferay Portal 6.2 + JSF 2.2.
efrain romero, modificado 7 Anos atrás.

RE: Problem Navigating Between Pages from JSF Portlets (Resposta)

New Member Postagens: 6 Data de Entrada: 01/08/16 Postagens Recentes
So, i fixed this. the problem was a compatibility issue with my beans.

Im using CDI and @Named beans. Now my page needed @ViewScoped but since i cannot use the native one. i tried to use (the one i always use) Omnifaces. However it doesnt work properly on my JSF Portlets.

Removed Omnifaces from my pom, and changed to ConversationScoped and its working properly. No more page wide refresh or component updates not processing properly