p:ajax feature not working in Liferay portal

前端 未结 1 1993
无人及你
无人及你 2021-01-16 23:57

I can\'t get the PrimeFaces 6.1 built-in ajax feature to work when using a liferay portal. I\'ve started with the very initial use case example, that is the one shown in the

相关标签:
1条回答
  • 2021-01-17 00:14

    I've just sorted the problem out. There were 2 problems. The first one (the less serious one) is that the js callbacks are being invoked wrong. The right way to invoke them should be as follows:

    <p:ajax process="@form" update="output" onstart="onStart()" oncomplete="onComplete()" onsuccess="onSuccess()" onerror="onError()" />
    

    The serious problem is related to a missing parameter in the liferay-portlet.xml config file. Well, it maybe I should haved started saying that I was dealing with a Liferay portlet containing a JSF portlet which uses Primefaces. It all implies that liferay-portlet.xml config file is required. And this config file has to contain the following parameter:

    <requires-namespaced-parameters>false</requires-namespaced-parameters>
    

    The problem is that the default liferay-portlet.xml file, that is, the one that the eclipse IDE wizard creates DOES NOT automatically include such a parameter. After including such a parameter, it all works as expected.

    (Down vote for Liferay people working in the Liferay Faces Bridge project).

    UPDATE: The way I create the Liferay Plugin Project.

    1. New > Project > Liferay Plugin Project

      Plugin Type: portlet

      Include Sample code -> unchecked

      Launch New Portlet Wizard afer project is created -> checked

    2. Next > JSF 2.x

    3. Next > Primefaces
    4. Finish

    Steps when Wizard is displayed:

    1. Portlet class: javax.portlet.faces.GenericFacesPortlet
    2. Next View template: Primefaces
    3. Next
    4. Finish

    Major result after those steps is that file liferay-portlet.xml doesn't have the element:

    <requires-namespaced-parameters>false</requires-namespaced-parameters>
    

    Development settings:

    • Eclipse Java EE IDE for Web Developers Version: Mars.2 Release (4.5.2) - Build id: 20160218-0600
    • Liferay IDE 2.2.4.201507230603-ga5

    Any clarification would be appreciated.

    0 讨论(0)
提交回复
热议问题