« 返回到 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 附件
92136 查看
平均 (2 票)
满分为 5,平均得分为 5.0。
评论
讨论主题回复 作者 日期
Hi, this may help someone... Filipe C 2012年11月14日 上午6:24
Hi, Thanks for your contribution. Excellent... Vishal Panchal 2013年2月18日 下午10:47
hi tnx for Wiki .. I can fix "Red X " , but my... ami sa 2014年2月6日 上午5:12
i have a problem where i create JSF Liferay,... Anderson Mendes dos Santos 2014年9月3日 上午8:52
Hi Anderson , The jsf project requires some... Lu Li 2014年9月3日 下午8:15
I try see in my ivy.xml file, but the version... Anderson Mendes dos Santos 2014年9月4日 上午6:33
3.2.4-ga5 should works no need to modify .you... Lu Li 2014年9月4日 下午7:33
Hi Lu Li, i created without error, i don't know... Anderson Mendes dos Santos 2014年9月8日 上午9:14
could you check if you can access the sites in... Lu Li 2014年9月8日 下午7:39
Yes Lu Li, i checked the folder, and the jars... Anderson Mendes dos Santos 2014年9月9日 上午5:32
Now run in the Liferay 6.2, i will try... Anderson Mendes dos Santos 2014年9月9日 上午5:36
I checked with Our JSF expert and he informed... Fady Hakim 2014年11月3日 下午1:54

Hi,
this may help someone
http://issues.liferay.com/browse/LPS-29049
在 12-11-14 上午6:24 发帖。
Hi,

Thanks for your contribution.
Excellent tutorial.

Regards,
Vishal
在 13-2-18 下午10:47 发帖。
hi
tnx for Wiki ..
I can fix "Red X " , but my portlet show empty content , dont show anything !!!
plz help emoticon
在 14-2-6 上午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
在 14-9-3 上午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
在 14-9-3 下午8:15 发帖以回复 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?
在 14-9-4 上午6:33 发帖以回复 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
在 14-9-4 下午7:33 发帖以回复 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...
在 14-9-8 上午9:14 发帖以回复 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
在 14-9-8 下午7:39 发帖以回复 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
在 14-9-9 上午5:32 发帖以回复 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.
在 14-9-9 上午5:36 发帖以回复 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.
在 14-11-3 下午1:54 发帖。