Fetched the threads for the particular category.
List<MBThread> threads= MBThreadLocalServiceUtil.getThreads(themeDisplay.getScopeGroupId(), 10010, 0, -1, -1);
Once fetched the threads of the particular show the result using the search container. If there is no results in the it is going to give the message no posts found which is going to fetch from the language.properties.
<liferay-ui:search-container delta="5" emptyResultsMessage="no-posts-found">
<liferay-ui:search-container-results
results="<%=ListUtil.subList(threads, searchContainer.getStart(), searchContainer.getEnd()) %>"
total="<%=threads.size()%>">
</liferay-ui:search-container-results>
<%--class name is the class which type of the list we have created for the search iterator.key property is the primary key for that value and modelVar is the variable
ofclassName type--%>
<liferay-ui:search-container-row
className="com.liferay.portlet.messageboards.model.MBThread"
keyProperty="threadId" modelVar="thread">
<%--For putting the value of the each column using the liferay-ui:search-container-column-text.name is the column name and the value is the value want to put into the column. --%>
<%--Name --%>
<liferay-ui:search-container-column-text name="Topic"
value="<%= MBMessageLocalServiceUtil.getMessage(thread.getRootMessageId()).getSubject()%>" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
If want to define own message in to custom portlet make entry following property into the <resource-bundle>com.qad.userprofile.content.Language</resource-bundle> . make the package com.qad.userprofile.content and put the language.properties file into that bundle.
Nice Post,
ReplyDeleteI have a question how can I use myown class in place of "com.liferay.portlet.messageboards.model.MBThread"
Does it need to extend some modelclass?
No it doesn't need to extends model classes
Delete