Message Boards
Portlet preferences and settings in Liferay 7 with SDK
Alexandre Terrasson, modified 6 Years ago.
Portlet preferences and settings in Liferay 7 with SDK
Junior Member Posts: 25 Join Date: 7/15/10 Recent Posts
Hi,
I was using Liferay 6.2 CE until now, and I developped some portlets using SDK.
I would like to do same with Liferay 7, and migrate my old portlets to the new platform.
But it seems SDK portlets don't work in Liferay 7 like they do in Liferay 6.
For now my major problem is to make my portlet configurable the same way than Liferay 6 (with settings/preferences of the portlet).
What I used to do is :
1/ Add "<configuration-action-class>com.liferay.myportlet.action.ConfigurationActionImpl</configuration-action-class>" in the liferay-portlet.xml.
2/ My ConfigurationActionImpl class implements the ConfigurationAction interface, which contains processAction() and render() methods.
3/ My main portlet class extends GenericPortlet class.
In Liferay 6 all was working fine, I got the button in the portlet menu to go to the portlet configuration settings/preferences, and it displayed my jsp configuration page.
In Liferay 7, there is the "configuration" button and an "Install" tab, but empty.
Is there something I missing ?
Just want to be able to make some settings or preferences to my portlet, in an easy way.
Thanks for you help ;)
ps : I tried to use the way of the edit-mode of the portlet (<portlet-mode>view</portlet-mode> in portlet.xml) but got the same issue : button "Preferences" is here but empty.
I was using Liferay 6.2 CE until now, and I developped some portlets using SDK.
I would like to do same with Liferay 7, and migrate my old portlets to the new platform.
But it seems SDK portlets don't work in Liferay 7 like they do in Liferay 6.
For now my major problem is to make my portlet configurable the same way than Liferay 6 (with settings/preferences of the portlet).
What I used to do is :
1/ Add "<configuration-action-class>com.liferay.myportlet.action.ConfigurationActionImpl</configuration-action-class>" in the liferay-portlet.xml.
2/ My ConfigurationActionImpl class implements the ConfigurationAction interface, which contains processAction() and render() methods.
3/ My main portlet class extends GenericPortlet class.
In Liferay 6 all was working fine, I got the button in the portlet menu to go to the portlet configuration settings/preferences, and it displayed my jsp configuration page.
In Liferay 7, there is the "configuration" button and an "Install" tab, but empty.
Is there something I missing ?
Just want to be able to make some settings or preferences to my portlet, in an easy way.
Thanks for you help ;)
ps : I tried to use the way of the edit-mode of the portlet (<portlet-mode>view</portlet-mode> in portlet.xml) but got the same issue : button "Preferences" is here but empty.
Ashish Singh, modified 6 Years ago.
RE: Portlet preferences and settings in Liferay 7 with SDK
Junior Member Posts: 45 Join Date: 12/1/16 Recent Posts
I think you want to acess dynamic values from preferences or configuration
To make your custom component configurable check this link
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/making-your-applications-configurable
To make your custom component configurable check this link
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/making-your-applications-configurable
Alexandre Terrasson, modified 6 Years ago.
RE: Portlet preferences and settings in Liferay 7 with SDK
Junior Member Posts: 25 Join Date: 7/15/10 Recent Posts
Hi Ashish,
Thanks for your reply.
I already know this link but this not really what I want.
It worked this way in LF6 and should still works in LF7 but that's not the case, so I would like to know why and how to do this way.
Moreover in the link they explain how to create a specific settings part in the control panel, that I don't want. I prefer a settings section directly from the portlet, as usual.
Thanks for your reply.
I already know this link but this not really what I want.
It worked this way in LF6 and should still works in LF7 but that's not the case, so I would like to know why and how to do this way.
Moreover in the link they explain how to create a specific settings part in the control panel, that I don't want. I prefer a settings section directly from the portlet, as usual.
Alexandre Terrasson, modified 6 Years ago.
RE: Portlet preferences and settings in Liferay 7 with SDK
Junior Member Posts: 25 Join Date: 7/15/10 Recent Posts
Hi,
I finally found that I must extends DefaultConfigurationAction instead of implements ConfigurationAction like in LF6 but it's not documented anywhere.....
So I can access my config.jsp page from the settings tabs of the portlet.
But I don't understand why it pass in the include() method of my configuration class and not in the processAction.
Well I can handle the whole configuration and preferences of my portlet in the include() method of the configuration class but I don't find that very nice....if someone has any idea about that....
I finally found that I must extends DefaultConfigurationAction instead of implements ConfigurationAction like in LF6 but it's not documented anywhere.....
So I can access my config.jsp page from the settings tabs of the portlet.
But I don't understand why it pass in the include() method of my configuration class and not in the processAction.
Well I can handle the whole configuration and preferences of my portlet in the include() method of the configuration class but I don't find that very nice....if someone has any idea about that....
Karthik Nainupatruni, modified 5 Years ago.
RE: Portlet preferences and settings in Liferay 7 with SDK
Junior Member Posts: 28 Join Date: 5/5/15 Recent PostsYou can achieve by implements ConfigurationAction only but in
Liferay7 they removed render() method for that you have to write
include() method ,
By using RequestDispatcher you can redirect
to your custom page. Please find the below for your reference.
Ex:
@Override
public void
include(PortletConfig portletConfig, HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
RequestDispatcher dispatcher =
request.getRequestDispatcher("/WEB-INF/jsp/sample/sample-exp.jsp");
dispatcher.include(request, response);
}
Sharath A, modified 5 Years ago.
RE: Portlet preferences and settings in Liferay 7 with SDK
New Member Posts: 6 Join Date: 3/6/19 Recent Posts
Hi All,
Can anyone tell me, the process to use PortletPreferences from SPRINGMVCPORTLET & make it work in Liferay7.1/DXP.
Regards,
Sharath
Can anyone tell me, the process to use PortletPreferences from SPRINGMVCPORTLET & make it work in Liferay7.1/DXP.
Regards,
Sharath