How to

Home Search

Use tapestry-Liferay instead of tapestry5-portlet

If you want to use Liferay api, it would be better to use https://github.com/got5/tapestry5-liferay This is module will help you to fill the gap between portlet JSR and liferay implemenation. this lib come with a sub module that can be used as a demo see https://github.com/got5/tapestry5-liferay/tree/master/tapestry-liferay-demo.

Deploying on LiferayOnce

Once Liferay is unpacked on your system, you simply have to run the server. To deploy your application on this running Liferay instance, simply change the build path of your war file by configuring the maven war plugin.

By doing this, you will be able to generate the war file directly in the "deploy" directory of your liferay installation. Once the file is copied in this directory, Liferay will hot deploy it. We also have to define the Module Class of our portlet, in order to load it.

Note that the "outputDirectory" must be declared in the "properties" section of your pom.xml file

liferay-portlet.xml

As many implementors Liferay Portal has its own features and behaviours. The "liferay-portlet.xml" file allows you to configure those. In case of Tapestry portlet integration, you will have to specify some of them to integrate well with Tapestry. Have a look at the snippet below:

Every portlet declared in the "portlet.xml" must match one element in this document. Also the "portlet-name" must match a corresponding portlet in portlet.xml.

Set the "action-url-redirect" to true, this is important to enable the redirect-after-post behaviour. By default, Liferay will not redirect the user after an action request but will simply launch render request in the same thread. This behaviour is not consistent with Tapestry’s design because it can lead to double-submit problem on page refresh.

Set the "instanceable" to true if you need to instantiate more than once per page.

Important: set the "private-request-attributes" to false will allow the portlet to share request attributes with others.This will allow us to handle JS and CSS includes properly within the portal page "head" part. Without this property set to false, you may have duplicate resources in the body of the containing portal page.

More in this section