Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Liferay 7.0 Override JournalDisplayContext.java
Hi,
goal to achive: default order descending in web content portlet
I tried to do this by overriding (module fragment project) toolbar.jsp but here i'm not able to modify the variable journalDisplayContext
So i need to override the JournalDisplayContext.java to set the default order to "desc", or is there any other way to achive my goal?
Thanks very much
Hello Carmine Azzaro,
I am also looking for a way to override JournalDisplayContext.java class through an extension module, meanwhile here's a working approach1. Override JSP of com.liferay.journal.web
2. You check current orderByType value for null
if (ParamUtil.getString(request, "orderByType")==null) {
PortletPreferencesFactoryUtil.getPortalPreferences(liferayPortletRequest).setValue("com_liferay_journal_web_portlet_JournalPortlet", "order-by-type", "desc");
}
meanwhile if you have find a way to override the JournalDisplayContext.java then do share it.
I am also looking for a way to override JournalDisplayContext.java class through an extension module, meanwhile here's a working approach1. Override JSP of com.liferay.journal.web
2. You check current orderByType value for null
if (ParamUtil.getString(request, "orderByType")==null) {
PortletPreferencesFactoryUtil.getPortalPreferences(liferayPortletRequest).setValue("com_liferay_journal_web_portlet_JournalPortlet", "order-by-type", "desc");
}
meanwhile if you have find a way to override the JournalDisplayContext.java then do share it.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™