Fórum

Wrong behavour of Primefaces + ajax + liferay 6.1

thumbnail
Konstantin Chudinov, modificado 10 Anos atrás.

Wrong behavour of Primefaces + ajax + liferay 6.1

Junior Member Postagens: 43 Data de Entrada: 23/04/13 Postagens Recentes
Hi guys!
Could someone explain me, what im doing wrong with primefaces' ajax:
view.xhtml:
 <h:form id="myform">
             <h:panelgrid columns="1">
                 ...
                 <p:selectonemenu id="monthSelector" value="#{myBean.selectedMonth}">
                     <f:selectitems value="#{myBean.monthItems}" />
                     <p:ajax update="out" listener="#{myBean.monthSelected}" />
                 </p:selectonemenu>
                 <h:outputtext id="out" value="#{myBean.i} " ... < code></h:outputtext></h:panelgrid></h:form>
<br>Bean:<br><pre><code> @ManagedBean(name = "myBean") @SessionScoped public class MyBean implements Serializable { private static final long serialVersionUID = -4610109006903875475L; private int i = 0; private List<selectitem> monthItems; private SelectItem selectedMonth; public MyBean () { ...//filling monthItems } public List<selectitem> getMonthItems() { return monthItems; } public void setMonthItems(List<selectitem> monthItems) { this.monthItems = monthItems; } public SelectItem getSelectedMonth() { return selectedMonth; } public void setSelectedMonth(SelectItem selectedMonth) { this.selectedMonth = selectedMonth; System.out.println("Value selected"); } public void monthSelected() { i++; System.out.println("Value changed"); } public int getI() { return i; } }</selectitem></selectitem></selectitem></code></pre><br><br><br>So console displays nothing...<br>My xmls are:<br>faces-config:<br><br><pre><code><!--?xml version="1.0"?--> <faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"> <lifecycle> <phase-listener>com.liferay.faces.util.lifecycle.DebugPhaseListener</phase-listener> </lifecycle> </faces-config> </code></pre><br><br>liferay-portlet<br><pre><code><liferay-portlet-app> <portlet> <portlet-name>MyPortlet</portlet-name> <icon>/icon.png</icon> <instanceable>false</instanceable> <ajaxable>false</ajaxable> <header-portlet-css>/css/main.css</header-portlet-css> <css-class-wrapper>MyPortlet-portlet</css-class-wrapper> </portlet> <role-mapper> <role-name>administrator</role-name> <role-link>Administrator</role-link> </role-mapper> <role-mapper> <role-name>guest</role-name> <role-link>Guest</role-link> </role-mapper> <role-mapper> <role-name>power-user</role-name> <role-link>Power User</role-link> </role-mapper> <role-mapper> <role-name>user</role-name> <role-link>User</role-link> </role-mapper> </liferay-portlet-app></code></pre>
thumbnail
Neil Griffin, modificado 10 Anos atrás.

RE: Wrong behavour of Primefaces + ajax + liferay 6.1

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
I would be my recommendation that you make sure that logging is enabled. It is good that you have the DebugPhaseListener specified in faces-config.xml but you also need to enable the logger in your src/main/resources/log4j.properties file, like this one from the primefaces3-portlet demo.

log4j.logger.com.liferay.faces.util.lifecycle.DebugPhaseListener=DEBUG
thumbnail
Konstantin Chudinov, modificado 10 Anos atrás.

RE: Wrong behavour of Primefaces + ajax + liferay 6.1

Junior Member Postagens: 43 Data de Entrada: 23/04/13 Postagens Recentes
Thanks for your reply!
But problem was in wrong using primefaces (Im a newer)
private SelectItem selectedMonth;

This variable should be String type
thumbnail
Kyle Joseph Stiemann, modificado 8 Anos atrás.

Thread Split

Liferay Master Postagens: 760 Data de Entrada: 14/01/13 Postagens Recentes
Please do not resurrect dead threads.

The new thread can be found at https://www.liferay.com/community/forums/-/message_boards/view_message/72518468.