« Torna a Liferay Faces

PrimeFaces Portlet Tutorial

Requirements:

For this tutorial, I am using:

  • Liferay IDE 2.0.0.201311051611-m2
  • Liferay Portal 6.2.0 ga1 bundled with Tomcat 7.0.42
  • liferay-plugins-sdk-6.2.0

Assumptions

  • You have already configured liferay portal instance and plugins SDK in your workspace
  • You have already completed and understand the basic ideas from following the steps in the development guide
    • Installing Liferay IDE
    • Setting Up the Liferay Plugins SDK
    • Liferay Portal Runtime and Server Setup
    • Launching and Testing Your Liferay Server

.

Step 1 - Create a Portlet Project #

File -> New -> Liferay Plugin Project

Enter the name of your portlet project, maybe something like "Primefaces-portlet"

Select Portlet -> Next

Select JSF 2 -> Next

Select PrimeFaces -> Finish

.

This could be a good time to add an additional repository to your ivy-settings.xml in your plugins-sdk if you need artifacts that are not in the default set of repositories that come configured in the plugins-sdk, such as sonatype's snapshot repository.

Step 2 - Get some coding done #

Yay!  Now it is time to work on a portlet page, and maybe add some content.  Add a primefaces calendar in the Primefaces-portlet/docroot/views/view.xhtml file under the hello world message like this:

<br />
<br />
<h:form>
   <p:calendar></p:calendar>
</h:form>

.

Step 3 - deploy your portlet #

Deploy the Primefaces portlet to your instance of Liferay Portal in one of the following two ways:

1) Drag the project to the running Liferay Portal Server entry in the "Servers" tab of Eclipse servers_tab

You may want to stop and start the server at this point.  I did have to do this once when running through this tutorial.

    or

2) from the command line inside your plugins SDK directory run the "ant war" command, and then copy the resulting war into the Liferay Portal deploy directory.

.

Step 4 - Add your portlet to a page #

.

Step 5 - Look at what you've done #

12 Allegati
58299 Visualizzazioni
Media (2 Voti)
La media del punteggio è 5.0 stelle su 5.
Commenti
Commenti Autore Data
Hi, this may help someone... Filipe C 14 novembre 2012 6.24
Hi, Thanks for your contribution. Excellent... Vishal Panchal 18 febbraio 2013 22.47
hi tnx for Wiki .. I can fix "Red X " , but my... ami sa 6 febbraio 2014 5.12
i have a problem where i create JSF Liferay,... Anderson Mendes dos Santos 3 settembre 2014 8.52
Hi Anderson , The jsf project requires some... Lu Li 3 settembre 2014 20.15
I try see in my ivy.xml file, but the version... Anderson Mendes dos Santos 4 settembre 2014 6.33
3.2.4-ga5 should works no need to modify .you... Lu Li 4 settembre 2014 19.33
Hi Lu Li, i created without error, i don't know... Anderson Mendes dos Santos 8 settembre 2014 9.14
could you check if you can access the sites in... Lu Li 8 settembre 2014 19.39
Yes Lu Li, i checked the folder, and the jars... Anderson Mendes dos Santos 9 settembre 2014 5.32
Now run in the Liferay 6.2, i will try... Anderson Mendes dos Santos 9 settembre 2014 5.36
I checked with Our JSF expert and he informed... Fady Hakim 3 novembre 2014 13.54

Hi,
this may help someone
http://issues.liferay.com/browse/LPS-29049
Inviato il 14/11/12 6.24.
Hi,

Thanks for your contribution.
Excellent tutorial.

Regards,
Vishal
Inviato il 18/02/13 22.47.
hi
tnx for Wiki ..
I can fix "Red X " , but my portlet show empty content , dont show anything !!!
plz help emoticon
Inviato il 06/02/14 5.12.
i have a problem where i create JSF Liferay, this is javax.portlet.faces.genericfacesportlet was not found on the java build path

in portlet.xml
Inviato il 03/09/14 8.52.
Hi Anderson ,

The jsf project requires some ivy dependence from the repositories sites , it will shows "javax.portlet.faces.genericfacesportlet was not found on the java build path" if it is not correct resolved .
Could you check your ivy.xml file in the project , the version of "liferay-faces-bridge-api" "liferay-faces-bridge-impl" etc should map to the the versions we have here ("3.2.4-ga5" should work for your project)
https://repository.liferay.com/nexus/content/groups/public/com/liferay/faces/lif­eray-faces-bridge-api/

Best Regards
Inviato il 03/09/14 20.15 in risposta a Anderson Mendes dos Santos.
I try see in my ivy.xml file, but the version that is "3.2.4-ga5", I need put the liferay-faces-bridge-api-3.2.4-ga5.jar some directory? Or just modify the ivy.xml?
Inviato il 04/09/14 6.33 in risposta a Lu Li.
3.2.4-ga5 should works no need to modify .you can do it the way to put jars to your ".ivy" file , but sdk is supposed to download the jar itself .let's see what's the problem there . After you create the project , wait the process of ivy resolve finished and check the "Error Log" see if you got any error like "Impossible to resolve dependencies of com.liferay#portlet_liferay_faces_alloy_tmpl" etc .thanks
Inviato il 04/09/14 19.33 in risposta a Anderson Mendes dos Santos.
Hi Lu Li, i created without error, i don't know what i did. The configuration of the proxy the my company may have been the cause? That was what changed...
Inviato il 08/09/14 9.14 in risposta a Lu Li.
could you check if you can access the sites in your ivy-settings.xml file via your company proxy ? check if the jars are really cached in your .ivy folder .ivy\cache\com.liferay.faces\liferay-faces-bridge-impl\jars
Inviato il 08/09/14 19.39 in risposta a Anderson Mendes dos Santos.
Yes Lu Li, i checked the folder, and the jars are there. I believe that issue was the proxy of my company. Thanks Lu Li for support the whole time. Sorry my poor english
Inviato il 09/09/14 5.32 in risposta a Lu Li.
Now run in the Liferay 6.2, i will try developer in version 6.1, because is the version that is in production.
Inviato il 09/09/14 5.36 in risposta a Anderson Mendes dos Santos.
I checked with Our JSF expert and he informed me the below:
"there are double copies of several of the jars in the deployed WEB-INF/lib folder.
For example, there was double Mojarra (jsf-api, jsf-impl), double liferay-faces*.jar, and double primefaces.jar
When I deleted all of the ones without the version numbers and restarted Liferay+Tomcat it started working."

I tried that and I deleted "jsf-impl.jar" and "liferay-faces-bridge-impl.jar" and it works as expected.
Inviato il 03/11/14 13.54.