Foren

PrimeFaces with Service Builder, event handling skips JSF Lifecycle phases

Valmik Desai, geändert vor 9 Jahren.

PrimeFaces with Service Builder, event handling skips JSF Lifecycle phases

New Member Beiträge: 2 Beitrittsdatum: 15.05.14 Neueste Beiträge
I want to use JSF/PrimeFaces as the view technology for my Liferay Service Builder project. Service Builder worked fine for me but most JSF Lifecycle phases (2, 3, 4 and 5) get skipped for my Events. A simple submit action on h:commandButton/p:commandButton doesn’t reach the application listener on my backing bean.

Following are relevant log messages from Liferay’s DebugPhaseListener:
19:01:10,087 DEBUG [DebugPhaseListener:64] BEFORE phaseId=[RESTORE_VIEW 1] viewId=[null]
19:01:10,089 DEBUG [DebugPhaseListener:48] AFTER phaseId=[RESTORE_VIEW 1] viewId=[/views/view.xhtml]
19:01:10,090 DEBUG [DebugPhaseListener:64] BEFORE phaseId=[RENDER_RESPONSE 6] viewId=[/views/view.xhtml]
19:01:10,096 DEBUG [DebugPhaseListener:48] AFTER phaseId=[RENDER_RESPONSE 6] viewId=[/views/view.xhtml]

Here is my view and bean code:
<!--?xml version="1.0" encoding="UTF-8"?-->
<ui:composition xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:aui="http://liferay.com/faces/aui" xmlns:aui-cc="http://liferay.com/faces/aui-cc" xmlns:liferay-ui="http://liferay.com/faces/ui" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">

	<h:form id="f1" styleclass="aui-form">
		<aui-cc:messages globalOnly="true" layout="table" />
		<h:panelgrid columns="4">
			<p:outputlabel for="string1Input" value="Enter a string:" />
			<p:inputtext id="string1Input" value="#{sampleTable.string1}" />
			<p:commandbutton id="actionButton" value="Submit" type="submit" actionListener="#{sampleTable.submit}" />
			<p:outputlabel value="#{sampleTable.string2}" />
		</h:panelgrid>
	</h:form>

</ui:composition>


package org.view;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ActionEvent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ManagedBean(name = "sampleTable")
@RequestScoped
public class SampleTableView {
	private static final Logger log = LoggerFactory.getLogger(SampleTableView.class);
	private String string1;
	private String string2;
	
	public SampleTableView() {
		log.debug("SampleTableView created.");
	}
	
	public void submit(ActionEvent event) {
		log.debug(org.view.SampleTableView.class.getName()+".action() invoked.");
		this.string2 = string1;
	}

	public String getString1() {
		return string1;
	}

	public void setString1(String string1) {
		this.string1 = string1;
	}

	public String getString2() {
		return string2;
	}

	public void setString2(String string2) {
		this.string2 = string2;
	}
}

Project directory is also attached.

I used Service Builder documentation and this PrimeFaces example to setup my project.

Following are the versions of the tools I use:
Liferay 6.2.1
JSF(com.sun.faces) 2.1.21
PrimeFaces 4.0

If anyone has faced a similar problem and can please help debug? Thanks!
thumbnail
Neil Griffin, geändert vor 9 Jahren.

RE: PrimeFaces with Service Builder, event handling skips JSF Lifecycle pha

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Did you specify the following in your WEB-INF/liferay-portlet.xml descriptor?

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


For more info, see the Liferay Faces 3.2.4-GA5 Release Announcement.
Valmik Desai, geändert vor 9 Jahren.

RE: PrimeFaces with Service Builder, event handling skips JSF Lifecycle pha

New Member Beiträge: 2 Beitrittsdatum: 15.05.14 Neueste Beiträge
That fixed it. Thanks Neil!
thumbnail
Neil Griffin, geändert vor 9 Jahren.

RE: PrimeFaces with Service Builder, event handling skips JSF Lifecycle pha

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
My pleasure -- thanks for using Liferay Faces emoticon