Search code examples
javaliferayportletjsr168jsr286

Writing Portlets for Liferay CMS/Portal


I am new to portlets and have a question about how they work in CMS portals ( we are evaluating Liferay as a CMS ).

Let's say, for example, I would like to create a portlet to display all the books required for a particular course. You don't have to be logged in to see this, it will appear on public website.

In the CMS, I will create two pages for ENGL-100 and HIST-300.

I want to add the same portlet on each page. I expect to deploy the portlet as a war file.

How will I tell the portlet on each page which course to look up? Don't tell me I have to change the portlet.xml file for each subject. Does a portlet have any access to URL parameters?


Solution

  • Yes, portlets can process URL parameters. That's the way you'd go to implement what you want. Depending on the page you are visiting, you just pass the course subject as a URL parameter and let the portlet process it for you. Of course you have to go to the database to look for the right course, etc to return the proper data.