Defining the Configuration in setting

In Liferay Core portlets you can see the portlet in setting tab as






Add the following entry in the liferay-portlet.xml after icon tag as

                   <configuration-action-class>
                             com.liferay.portal.kernel.portlet.DefaultConfigurationAction
                </configuration-action-class>


and define the following in the portlet.xml as

    <init-param>
<name>config-template</name>
<value>/html/test/config.jsp</value>
</init-param>

In Config.jsp

If you want to save the entries in the preferences  it is very simple

<liferay-portlet:actionURL var="configURL" portletConfiguration = "true"/>

    <aui:form action="${configURL}">
         1. <aui:input type="hidden" name="cmd" value="update"/>       
         2. <aui:input  name="perferences--test--"/>   
   </aui:form>

Here 1 and 2nd steps are mandatory to save the preferences . but the name test can be anything.

These two steps are mandatory because if we look into the DefaultConfigurationAction class of processAction method it as follows


public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse) throws Exception {
                                     -------------
                                    ---------------
}


Comments

  1. Can you tell me how to change the name of the tab.
    For example I want to change the name from "Setup" to "Places"

    ReplyDelete
    Replies
    1. Hi Mitra,

      Did you figure out the solution for it!! ?

      Delete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate