jsf - p:ajax feature not working in Liferay portal -
i can't primefaces 6.1 built-in ajax feature work when using liferay portal. i've started initial use case example, 1 shown in pf user's guide documentation , nothing happens, absolutely nothing happens.
xhtml side
<h:form id="form"> <h:inputtext value="#{bentitytree.text}"> <p:ajax process="@form" update="output" onstart="onstart" oncomplete="oncomplete" onsuccess="onsuccess" onerror="onerror"/> </h:inputtext> <br/> <h:outputtext id="output" value="valor:#{bentitytree.text}"/> </h:form> bean side:
@managedbean(name = "bean") @viewscoped public class bean implements serializable { private static logger logger = logger.getlogger(bentitytree.class); private string text; public bean() { logger.trace("bean created"); } @postconstruct private void onpostconstruct() { logger.trace("start"); } public string gettext() { logger.trace("getting text:" + text); return text; } public void settext(string text) { logger.trace("setting text:" + text); this.text = text; } } js side:
function onstart(){ console.log("onstart"); } function oncomplete(){ console.log("oncomplete"); } function onsuccess(){ console.log("onsuccess"); } function onerror(){ console.log("onerror"); } according documentation states, each time input changes ajax request sent server. understanding input changes when 'onchange' event fired (default client side event). well, every time type character in <h:inputtext> element nothing happens. when <p:inputtext> looses focus nothing happens, is, <h:outputtext> isn't updated , trace console displayed on console of chrome browser. trace log 1 ide console:
[trace] bean:<init>():bean created [trace] bean:onpostconstruct():start [trace] bean:gettext():getting text:null [trace] bean:gettext():getting text:null i don't know i'm doing wrong, i'm missing. pretty appreciated.
i've sorted problem out. there 2 problems. first 1 (the less serious one) js callbacks being invoked wrong. right way invoke them should follows:
<p:ajax process="@form" update="output" onstart="onstart()" oncomplete="oncomplete()" onsuccess="onsuccess()" onerror="onerror()" /> the serious problem related missing parameter in liferay-portlet.xml config file. well, maybe should haved started saying dealing liferay portlet containing jsf portlet uses primefaces. implies liferay-portlet.xml config file required. , config file has contain following parameter:
<requires-namespaced-parameters>false</requires-namespaced-parameters> the problem default liferay-portlet.xml file, is, 1 eclipse ide wizard creates not automatically include such parameter. after including such parameter, works expected.
(down vote liferay people working in liferay faces bridge project).
Comments
Post a Comment