Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
foxmolder5 foxmolder5
Add configuration tab to a Portlet
April 9, 2009 10:39 AM
Answer

foxmolder5 foxmolder5

Rank: New Member

Posts: 14

Join Date: October 29, 2008

Recent Posts

Hi
i'm trying to add a configuration tab to a StrutsPortlet i created, i found variuos method but none of them works. I'm developing in Ext Enviroment and I followed this wiki Add a Configuration Page to a Portlet or i use "configuration-action-class" tag in portlet-ext.xml .
When i go to portlet configuration page i see only "Permission" and "Share" Tab. It seems Liferay doesn't find forwarding in the first method and ConfigurationClass in the second one.
Someone can help me?
Thanks in advance

John
Amos Fong
RE: Add configuration tab to a Portlet
April 9, 2009 11:07 AM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1844

Join Date: October 7, 2008

Recent Posts

Hm...do you have something like this in your configurationaction class

1    public String render(
2            PortletConfig portletConfig, RenderRequest renderRequest,
3            RenderResponse renderResponse)
4        throws Exception {
5
6        return "/configuration.jsp";
7    }
foxmolder5 foxmolder5
RE: Add configuration tab to a Portlet
April 16, 2009 11:20 PM
Answer

foxmolder5 foxmolder5

Rank: New Member

Posts: 14

Join Date: October 29, 2008

Recent Posts

yes.
this is the code:

1
2    public String render(
3            PortletConfig portletConfig, RenderRequest renderRequest,
4            RenderResponse renderResponse)
5        throws Exception {
6        System.out.println("check");
7        return "/html/portlet/ext/package_name/configuration.jsp";
8    }


but i never see "check" showing.

Instead this is the definition portlet code in portlet-ext.xml

 1
 2    <portlet>
 3        <portlet-name>show_information_visual</portlet-name>
 4        <icon>/html/icons/default.png</icon>
 5        <display-name>Show Information Visual</display-name>
 6        <portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
 7        <configuration-action-class>com.ext.portlet.packageName.action.ConfigurationActionImpl</configuration-action-class>
 8        <init-param>
 9            <name>view-action</name>
10            <value>/ext/package_name/view</value>
11        </init-param>
12        <expiration-cache>0</expiration-cache>
13        <resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
14        <security-role-ref>
15            <role-name>power-user</role-name>
16        </security-role-ref>
17        <security-role-ref>
18            <role-name>user</role-name>
19        </security-role-ref>
20    </portlet>


i don't know where error is.
Christianto Sahat
RE: Add configuration tab to a Portlet
April 19, 2009 7:11 PM
Answer

Christianto Sahat

Rank: Regular Member

Posts: 175

Join Date: September 24, 2007

Recent Posts

You have to put your <configuration-action-class> in liferay-portlet-ext.xml, NOT in portlet-ext.xml. Take a look liferay-portlet.xml under ${liferay.portal.source}/portal-web/docroot/WEB-INF/liferay-portlet.xml


 1
 2    <portlet>
 3        <portlet-name>8</portlet-name>
 4        <icon>/html/portlet/calendar/icon.png</icon>
 5        <struts-path>calendar</struts-path>
 6        <configuration-action-class>com.liferay.portlet.calendar.action.ConfigurationActionImpl</configuration-action-class>
 7        <scheduler-class>com.liferay.portlet.calendar.job.CalendarScheduler</scheduler-class>
 8        <portlet-data-handler-class>com.liferay.portlet.calendar.lar.CalendarPortletDataHandlerImpl</portlet-data-handler-class>
 9        <social-activity-interpreter-class>com.liferay.portlet.calendar.social.CalendarActivityInterpreter</social-activity-interpreter-class>
10        <preferences-unique-per-layout>false</preferences-unique-per-layout>
11        <use-default-template>false</use-default-template>
12        <show-portlet-access-denied>true</show-portlet-access-denied>
13        <show-portlet-inactive>true</show-portlet-inactive>
14        <restore-current-view>false</restore-current-view>
15        <private-request-attributes>false</private-request-attributes>
16        <private-session-attributes>false</private-session-attributes>
17        <render-weight>1</render-weight>
18        <header-portlet-css>/html/portlet/calendar/css.jsp</header-portlet-css>
19        <css-class-wrapper>portlet-calendar</css-class-wrapper>
20</portlet>



foxmolder5 foxmolder5:


Instead this is the definition portlet code in portlet-ext.xml

1
2    <portlet>
3        <portlet-name>show_information_visual</portlet-name>
4        <icon>/html/icons/default.png</icon>
5        <display-name>Show Information Visual</display-name>
6        <portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
7        <configuration-action-class>com.ext.portlet.packageName.action.ConfigurationActionImpl</configuration-action-class>
8    </portlet>


i don't know where error is.
pop
Stanislav S.
RE: Add configuration tab to a Portlet
April 19, 2012 12:03 PM
Answer

Stanislav S.

Rank: New Member

Posts: 3

Join Date: April 19, 2012

Recent Posts

Apparently, after three years, I'm having the same problem.
No exceptions, no errors -- and also no "Setup" tab in preferences.

Liferay-portlet.xml
 1
 2<portlet>
 3    <portlet-name>CustomPortlet</portlet-name>
 4    <icon>/icon.png</icon>
 5    <configuration-action-class>workbox.CustomPortlet.CustomConfigurationAction</configuration-action-class>
 6    <instanceable>false</instanceable>
 7    <header-portlet-css>/css/main.css</header-portlet-css>
 8    <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
 9    <css-class-wrapper>CustomPortlet-portlet</css-class-wrapper>
10</portlet>


CustomConfigurationAction.java:
 1
 2public class CustomConfigurationAction implements com.liferay.portal.kernel.portlet.ConfigurationAction {
 3    @Override
 4    public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
 5            ActionResponse actionResponse) throws Exception {
 6    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
 7          if (!cmd.equals(Constants.UPDATE)) {
 8              return;
 9          }
10          System.out.println("Beep");
11         /* Lots of useless code */
12    }
13
14    @Override
15    public String render(PortletConfig portletConfig, RenderRequest actionRequest,
16            RenderResponse actionResponse) throws Exception {
17        System.out.println("Beep");
18        return "/html/configuration.jsp";
19    }
20}


Not a single beep at all.
Jsp is in place and feels fine, but it just isn't called.
Will be very grateful for anyone who could give any advice.
anson yvs
RE: Add configuration tab to a Portlet
December 11, 2012 5:59 PM
Answer

anson yvs

Rank: New Member

Posts: 22

Join Date: August 8, 2012

Recent Posts

Stanislav S.:
Apparently, after three years, I'm having the same problem.
No exceptions, no errors -- and also no "Setup" tab in preferences.

Liferay-portlet.xml
 1
 2<portlet>
 3    <portlet-name>CustomPortlet</portlet-name>
 4    <icon>/icon.png</icon>
 5    <configuration-action-class>workbox.CustomPortlet.CustomConfigurationAction</configuration-action-class>
 6    <instanceable>false</instanceable>
 7    <header-portlet-css>/css/main.css</header-portlet-css>
 8    <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
 9    <css-class-wrapper>CustomPortlet-portlet</css-class-wrapper>
10</portlet>


CustomConfigurationAction.java:
 1
 2public class CustomConfigurationAction implements com.liferay.portal.kernel.portlet.ConfigurationAction {
 3    @Override
 4    public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
 5            ActionResponse actionResponse) throws Exception {
 6    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
 7          if (!cmd.equals(Constants.UPDATE)) {
 8              return;
 9          }
10          System.out.println("Beep");
11         /* Lots of useless code */
12    }
13
14    @Override
15    public String render(PortletConfig portletConfig, RenderRequest actionRequest,
16            RenderResponse actionResponse) throws Exception {
17        System.out.println("Beep");
18        return "/html/configuration.jsp";
19    }
20}


Not a single beep at all.
Jsp is in place and feels fine, but it just isn't called.
Will be very grateful for anyone who could give any advice.





Try this, perhaps.
Change these in configuration.jsp,
1<%@ taglib uri="[[http://java.sun.com/portlet|http://java.sun.com/portlet]]" prefix="portlet" %> <%@ taglib uri="[[http://liferay.com/tld/portlet|http://liferay.com/tld/portlet]]" prefix="liferay-portlet" %> <%@ page import="com.liferay.portal.kernel.util.Constants" %>

To :
1<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>


Refering here


Thanks,
Anson