Foros de discusión

Problem Navigating Between Pages from JSF Portlets

efrain romero, modificado hace 7 años.

Problem Navigating Between Pages from JSF Portlets

New Member Mensajes: 6 Fecha de incorporación: 1/08/16 Mensajes recientes
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 hace 7 años.

RE: Problem Navigating Between Pages from JSF Portlets

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
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 hace 7 años.

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

New Member Mensajes: 6 Fecha de incorporación: 1/08/16 Mensajes recientes
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