Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jean-Noel Colin
How do I retrieve the list of article types from a JSF portlet
August 27, 2008 8:01 AM
Answer

Jean-Noel Colin

Rank: New Member

Posts: 17

Join Date: February 11, 2008

Recent Posts

Hi

I've written a jsf portlet, and I would need to retrieve the list of available article types (news, general, annoucement,...) to create a combobox. What's the right way to do that?

Thanks for your help

Jean-Noel Colin
Christopher Olbertz
RE: How do I retrieve the list of article types from a JSF portlet
August 27, 2008 8:12 AM
Answer

Christopher Olbertz

Rank: Regular Member

Posts: 107

Join Date: November 21, 2007

Recent Posts

Hi Jean-Noel,

my problem was similiar to yours. I solved it in the following way:

I created a bean, which contains service-methods. I will call it ArticleService. It is a managed bean with the name articleServce in the faces-config.xml.

Now, you build a method ArrayList ArticleService.getArticleList(). In this method, you can read the list from the database and return it as ArrayList. You can display the data for example in a datatable. Here is an example:

<h:dataTable id="articles" value="#{articleService.articleList}" var="row" border="1">

The variable "row" is the current article. You can access it in buttons for example with row.news.

I hope, you understand, what I mean.

Here is a link to a tutorial, which helped me very much.

http://www.laliluna.de/first-java-server-faces-tutorial.html

Christopher
Jean-Noel Colin
RE: How do I retrieve the list of article types from a JSF portlet
August 27, 2008 8:18 AM
Answer

Jean-Noel Colin

Rank: New Member

Posts: 17

Join Date: February 11, 2008

Recent Posts

Hi Christopher

THanks a lot for your response; I do understand the JSF part, my question was more how to retrieve the list of article types from Liferay as well as the localized version.

Best

Jean-Noel
Christopher Olbertz
RE: How do I retrieve the list of article types from a JSF portlet
August 27, 2008 8:25 AM
Answer

Christopher Olbertz

Rank: Regular Member

Posts: 107

Join Date: November 21, 2007

Recent Posts

Hi Jean-Noel,

I'm sorry. I missunderstood you. I was glad, that I can help anybody this time, because I normally need a lot of help. But now, I can't help you.

I hope, you find an answer for your problem.

Christopher
Ray Augé
RE: How do I retrieve the list of article types from a JSF portlet
August 27, 2008 11:04 AM
Answer

Ray Augé

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1195

Join Date: February 7, 2005

Recent Posts

Try:

String[] TYPES = PropsUtil.getArray(PropsKeys.JOURNAL_ARTICLE_TYPES);

HTH!
Jean-Noel Colin
RE: How do I retrieve the list of article types from a JSF portlet
August 27, 2008 12:00 PM
Answer

Jean-Noel Colin

Rank: New Member

Posts: 17

Join Date: February 11, 2008

Recent Posts

Thanks. That's definitely going in the good direction, but I'm developing in the plugin enviromnent, and the only method available from PropsUtils is get(String)

It seems that the class you're refering to is com/liferay/portal/util/PropsUtil.java while the one available in the plugin environment is com/liferay/portal/kernel/util/PropsUtil.java

Is there a way to obtain those values from the plugin SDK env?

Thanks

Jean-Noel