views:

1870

answers:

2

I have a Struts portlet being used in a Liferay Portal environment. I have been localizing my resource strings using standard resource files so far. I can access the message bundle from my portlet using the <bean:message> tag, and it works great. So for example, in a form I might have the following label defined in my JSP file.

...
<label for="firstname">
    <bean:message key='labels.firstname'/>
</label>
...

This works fine for short strings that don't change after compile time. I can localize my strings properly, compile my portlet, and it just works.

Problem: I have a requirement to allow portal content authors to modify content used in my portlet, on-the-fly, after compilation. My first thought was to use Liferay's web content system, so content authors could create localized web content pieces that I could access from my portlet's JSP files.

Question: Is a way to access Liferay web content from inside my portlet?

+1  A: 

Have you looked at the Content Management System included in liferay? That could be the answer to your need. It would allow content authors to create content in the CMS and then you could write template JSPs that would pull in the content from there.

Liferay CMS

jkf
That's what I'm asking about. I'm just unsure of how to access pieces of the CMS from inside my JSP page.
William Brendel
Documentation is one big gripe I have with Liferay. There doesn't appear to be any clear development guide, just the wiki, which implies you know what you're looking for.Since its open source, you might try taking a look at the code for the Asset Publisher portlet and see how it works.
jkf
+2  A: 

There is a tag from the liferay-ui that displays the content of a CMS "article" :

<liferay-ui:journal-article articleId="YOUR_ARTICLE_ID" groupId="<%= groupId %>" />

It can be used for example to display variable "terms of use", as explained here

You can also find some inspiration in the content display portlet jsps for a more flexible approach.

Arnaud Deslandes
This looks like exactly what I need. Thanks so much!
William Brendel