Sunday, November 18, 2012

How to create JSF2 Portlet in Liferay

The purpose of this post is to provide an entry level tutorial on how to create JSF2 portlet in Liferay Portal.

Required software / tools:
1. Eclipse (Juno)
2. Liferay Portal 6.1.1 with tomcat bundled
3. Liferay IDE 6.1.1
4. Liferay Plugin sdk 6.1.1

Prerequisites:
1. make sure Liferay development environment is properly setup


Steps:
1. File > New > Other >Liferay > Liferay Project > Next
2. Fill in project details
    - Select Portlet as Plugin Type
3. Select Project framework and implementation, Finish
    - Select JSF 2.x, then select preferred JSF2 implementation

4. JSF2 Portlet created

5. There is a bug with the current version of Liferay IDE, where the phase listener still pointing to previous version of portlet bridge. so we have to change the phase listener manually.
    a. open faces-config.xml
    b. change the phase listener to com.liferay.faces.util.lifecycle.DebugPhaseListener
    c. save

6. Deploy the JSF2 portlet
    a. open "Server" view, R-click on "Liferay v6.1 CE Server"
    b. Add and Remove > Add the JSF2 Portlet into Configured panel
    c. Finish

7. Test 
    a. login to Liferay as administrator
    b. Add the portlet into page
        - Add > more > sample > JSF2Test > Add

8. Done

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...