Fórum

Liferay 6.2 and Primefaces 5

thumbnail
Johannes Köber, modificado 9 Anos atrás.

Liferay 6.2 and Primefaces 5

New Member Postagens: 3 Data de Entrada: 01/03/12 Postagens Recentes
Hi Guys,

i would use liferay 6.2 with primefaces 5 but i have found some problems with buttons.
in my project i've used a liferay 6.2 maven portlet with cid bridge and all based on maven.

you can copy the project from github.
https://github.com/jkoeber/liferayPrimefaces

in the test- portlet is the actual portlet-bridge and so on:
<com.liferay.faces.version>3.2.4-ga5</com.liferay.faces.version>

and dependencies:

<dependency>
			<groupid>com.liferay.faces</groupid>
			<artifactid>liferay-faces-bridge-impl</artifactid>
			<version>${com.liferay.faces.version}</version>
		</dependency>
		<dependency>
			<groupid>com.liferay.faces</groupid>
			<artifactid>liferay-faces-bridge-impl</artifactid>
			<version>${com.liferay.faces.version}</version>
		</dependency>
		<dependency>
			<groupid>com.liferay.faces</groupid>
			<artifactid>liferay-faces-util</artifactid>
			<version>${com.liferay.faces.version}</version>
		</dependency>
		<dependency>
			<groupid>com.liferay.faces</groupid>
			<artifactid>liferay-faces-portal</artifactid>
			<version>${com.liferay.faces.version}</version>
		</dependency>


For persistence i don't use a standard liferay service builder. i have implemented an jpa project
with entity. simple cause i don't need to much overhead for the example.

info:
the whole package is based on the glassfish- bundle of liferay 6.2 and glassfish 3.2.2.

check out the project. in Test is a ProjectSet file for direct import to eclipse.
thx for help emoticon
thumbnail
Juan Gonzalez, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Hi Johannes,

does your problem reside in duplication of buttons?

Did you try using primefaces-4?

BTW, why are you using liferay-portlet DTD for your view.xhtml?

https://github.com/jkoeber/liferayPrimefaces/blob/master/Test/src/main/webapp/views/view.xhtml#L1-2
thumbnail
Johannes Köber, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

New Member Postagens: 3 Data de Entrada: 01/03/12 Postagens Recentes
Hi Juan,

The DTD was only experimental. I've found a tipp in some threads where the solution was to add the dtd in head.
But no effect by myself.

The double button is also an experiment. cause one button is in:
<f:facet name="footer" />

and the other only in <h:form> outside the grid.

And i will use Primefaces 5 for multiselect option which is not included in pf4. emoticon
thumbnail
Juan Gonzalez, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
So, what is the real problem with your buttons? I guess you didn't say it emoticon.
thumbnail
Johannes Köber, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

New Member Postagens: 3 Data de Entrada: 01/03/12 Postagens Recentes
Oh sorry, emoticon

the problem is that the action doesn't fire in backend.
i see the action in firebug and a response back.
but in logfilre there is nothing fired.

the method which is called:

public void createReservation() {
		log.info("Store Reservation!");
		long count;
		try {
			count = CounterLocalServiceUtil.increment(Reservation.class.getName());
			reservation.setUserid(myUser.getUserId());
			reservation.setId(count);
		} catch (SystemException e) {
			log.error(e.getMessage());
		}

		em.persist(reservation);
		em.flush();

		log.info("Reservation is: " + reservation.toString());
	}


i can use:

<p:commandbutton value="Reservierung speichern" action="#{reservationBean.createReservation}" process=":reservationForm" update=":reservationTable" />


or

<p:commandbutton value="Reservierung speichern" action="#{reservationBean.createReservation()}" process=":reservationForm" update=":reservationTable" />


but nothing works. the method won't be run :-(
thumbnail
Juan Gonzalez, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Hi Johannes,

I could run your portlet in tomcat, and both buttons were working:

10:51:04,597 INFO  [http-bio-8080-exec-5][ReservationBean:68] Store Reservation!
10:51:04,623 INFO  [http-bio-8080-exec-5][ReservationBean:81] Reservation is: com.jkoeber.test.jpa.Reservation@4e147148


For getting it working in tomcat, I had to add this to pom.xml:

<profile>
			<id>tomcat</id>
			<dependencies>
				<dependency>
					<groupid>org.jboss.weld.servlet</groupid>
					<artifactid>weld-servlet</artifactid>
					<version>1.1.10.Final</version>
				</dependency>
			</dependencies>
		</profile>.
.
.

			<dependency>
				<groupid>javax.enterprise</groupid>
				<artifactid>cdi-api</artifactid>
				<version>1.0-SP4</version>
			</dependency>
		<dependency>
</dependency>


and comment these lines:

<!-- <exclusions>
				<exclusion>
					<artifactId>el-api</artifactId>
					<groupId>javax.el</groupId>
				</exclusion>
			</exclusions>-->


and set web.xml same as in Liferay Faces CDI demo web.xml for Tomcat

Are you sure your portlet is deploying properly? Are there any error or warning messages?
Numazaki Emilio, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

New Member Postagens: 7 Data de Entrada: 27/10/10 Postagens Recentes
Guys, I'm facing exacly same problem. I don't know what is happening but a command button that is in portlet is not firing the action in backing bean.

Is there any specific configuration that I should do to run PrimeFaces 5.0 in Liferay 6.2?

Here is the code: https://github.com/emilioyn/liferay-pf5-portlet

Thank you
thumbnail
Neil Griffin, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Hi Emilio,

Did you set the following in your WEB-INF/portlet.xml descriptor?
<requires-namespaced-parameters>false</requires-namespaced-parameters>

For more info, see the release announcement.

Kind Regards,

Neil
Emilio Numazaki, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

New Member Postagens: 7 Data de Entrada: 27/10/10 Postagens Recentes
Neil Griffin:
Hi Emilio,

Did you set the following in your WEB-INF/portlet.xml descriptor?
<requires-namespaced-parameters>false</requires-namespaced-parameters>

For more info, see the release announcement.

Kind Regards,

Neil



Hi Neil! Thank your for your answer.

Actually my first attempt was done executing LR IDE wizard and it didn't work. I mean, I have same error as I described in my previous post.

Now I did upgrade to PrimeFaces 5.x but no success.
thumbnail
Neil Griffin, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Hi Emilio,

When you get a chance, please try two things:

1. For the line of code that has p:commandButton, set ajax="false" and let me know if it works as a full postback.

2. Temporarily Downgrade to PrimeFaces 4 and let me know if it works with ajax="true" and ajax="false"

Thanks,

Neil
Emilio Numazaki, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

New Member Postagens: 7 Data de Entrada: 27/10/10 Postagens Recentes
Neil Griffin:
Hi Emilio,

When you get a chance, please try two things:

1. For the line of code that has p:commandButton, set ajax="false" and let me know if it works as a full postback.

2. Temporarily Downgrade to PrimeFaces 4 and let me know if it works with ajax="true" and ajax="false"

Thanks,

Neil


Hi Neil! I don't know exactly what I did but now it's working on PF4.0.

Now I'm gonna try to upgrade to PF5.0. Is there any special requirements to do it?

Thank you
thumbnail
Neil Griffin, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Upgrading should be as easy as changing the version to 5.0 in the pom.xml descriptor, rebuilding, and re-deploying. Just make sure that you delete tomcat/webapps/yourportlet before deploying, because you don't want both primefaces-4.0.jar and primefaces-5.0.jar to be there at the same time.

I'm interested to know if the p:commandButton works in PrimeFaces 5.0 because in this other thread a community member said that navigation wasn't working with ajax="true"
Emilio Numazaki, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

New Member Postagens: 7 Data de Entrada: 27/10/10 Postagens Recentes
Neil Griffin:
Upgrading should be as easy as changing the version to 5.0 in the pom.xml descriptor, rebuilding, and re-deploying. Just make sure that you delete tomcat/webapps/yourportlet before deploying, because you don't want both primefaces-4.0.jar and primefaces-5.0.jar to be there at the same time.

I'm interested to know if the p:commandButton works in PrimeFaces 5.0 because in this other thread a community member said that navigation wasn't working with ajax="true"


Hi Neil, I just upgraded to PF5.0 and commandButton with AJAX is still working. I really don't know what happened but I suppose there is something related to library version. What I did to upgrade to PF5.0 was:
1) Create a project through LR-IDE wizard
2) Create a JSF PrimeFaces portlet through wizard (all standard choices)
3) Change version of PF to 5.0 in pom.xml
4) Added (according to what Juan suggested)


<dependency>
	<groupid>org.jboss.weld.servlet</groupid>
	<artifactid>weld-servlet</artifactid>
	<version>1.1.10.Final</version>
</dependency>
<dependency>
	<groupid>javax.enterprise</groupid>
	<artifactid>cdi-api</artifactid>
	<version>1.0-SP4</version>
</dependency>


5) Found missing lib and after some research I added:


<dependency>
	<groupid>com.liferay.cdi</groupid>
	<artifactid>cdi-portlet-bridge-shared</artifactid>
	<version>6.2.0.1</version>
</dependency>


Commented:


<!-- <exclusions>
		<exclusion>
			<artifactId>el-api</artifactId>
			<groupId>javax.el</groupId>
		</exclusion>
     </exclusions>-->


From Juan's hint: Set web.xml same as in Liferay Faces CDI demo web.xml for Tomcat: https://github.com/liferay/liferay-faces/blob/3.2.4-ga5/demos/bridge/jsf2-cdi-portlet/src/main/webapp/WEB-INF/web-tomcat.xml
thumbnail
Neil Griffin, modificado 9 Anos atrás.

RE: Liferay 6.2 and Primefaces 5

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Hi Emilio,

Thanks for letting us know the good news that it is working. BTW if you are developing with CDI, I would recommend that you read the Developing JSF Portlets with CDI wiki article. In addition, you should use cdi-portlet-bridge-shared-6.2.0.2.jar since it has some nice bug fixes.

Kind Regards,

Neil
Emilio Numazaki, modificado 8 Anos atrás.

Re: [Liferay Forums][Liferay Faces - English] RE: Liferay 6.2 and Primeface

New Member Postagens: 7 Data de Entrada: 27/10/10 Postagens Recentes
Great Neil! Thank you!


2014-08-08 19:05 GMT-03:00 Neil Griffin from liferay.com <forums@liferay.com
>:

> Hi Emilio,
>
> Thanks for letting us know the good news that it is working. BTW if you
> are developing with CDI, I would recommend that you read the Developing
> JSF Portlets with CDI
> <https://www.liferay.com/community/wiki/-/wiki/Main/Developing+JSF+Portlets+with+CDI>
> wiki article. In addition, you should use
> cdi-portlet-bridge-shared-6.2.0.2.jar
> <http://search.maven.org/#artifactdetails%7Ccom.liferay.cdi%7Ccdi-portlet-bridge-shared%7C6.2.0.2%7Cjar>
> since it has some nice bug fixes.
>
> Kind Regards,
>
> Neil
>
>
> To view the thread, follow the link below:
>
> https://www.liferay.com/community/forums/-/message_boards/view_message/41199954
> --
> Liferay.com <https://www.liferay.com>