« Back to 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 Attachments
40330 Views
Average (2 Votes)
The average rating is 5.0 stars out of 5.
Comments
Threaded Replies Author Date
Hi, this may help someone... Filipe C November 14, 2012 6:24 AM
Hi, Thanks for your contribution. Excellent... Vishal Panchal February 18, 2013 10:47 PM
hi tnx for Wiki .. I can fix "Red X " , but my... ami sa February 6, 2014 5:12 AM
i have a problem where i create JSF Liferay,... Anderson Mendes dos Santos September 3, 2014 8:52 AM
Hi Anderson , The jsf project requires some... Lu Li September 3, 2014 8:15 PM
I try see in my ivy.xml file, but the version... Anderson Mendes dos Santos September 4, 2014 6:33 AM
3.2.4-ga5 should works no need to modify .you... Lu Li September 4, 2014 7:33 PM
Hi Lu Li, i created without error, i don't know... Anderson Mendes dos Santos September 8, 2014 9:14 AM
could you check if you can access the sites in... Lu Li September 8, 2014 7:39 PM
Yes Lu Li, i checked the folder, and the jars... Anderson Mendes dos Santos September 9, 2014 5:32 AM
Now run in the Liferay 6.2, i will try... Anderson Mendes dos Santos September 9, 2014 5:36 AM
I checked with Our JSF expert and he informed... Fady Hakim November 3, 2014 1:54 PM

Hi,
this may help someone
http://issues.liferay.com/browse/LPS-29049
Posted on 11/14/12 6:24 AM.
Hi,

Thanks for your contribution.
Excellent tutorial.

Regards,
Vishal
Posted on 2/18/13 10:47 PM.
hi
tnx for Wiki ..
I can fix "Red X " , but my portlet show empty content , dont show anything !!!
plz help emoticon
Posted on 2/6/14 5:12 AM.
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
Posted on 9/3/14 8:52 AM.
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
Posted on 9/3/14 8:15 PM in reply to 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?
Posted on 9/4/14 6:33 AM in reply to 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
Posted on 9/4/14 7:33 PM in reply to 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...
Posted on 9/8/14 9:14 AM in reply to 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
Posted on 9/8/14 7:39 PM in reply to 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
Posted on 9/9/14 5:32 AM in reply to 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.
Posted on 9/9/14 5:36 AM in reply to 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.
Posted on 11/3/14 1:54 PM.