Fórum

Add configuration tab to a Portlet

foxmolder5 foxmolder5, modificado 15 Anos atrás.

Add configuration tab to a Portlet

New Member Postagens: 14 Data de Entrada: 29/10/08 Postagens Recentes
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
thumbnail
Amos Fong, modificado 15 Anos atrás.

RE: Add configuration tab to a Portlet

Liferay Legend Postagens: 2047 Data de Entrada: 07/10/08 Postagens Recentes
Hm...do you have something like this in your configurationaction class

	public String render(
			PortletConfig portletConfig, RenderRequest renderRequest,
			RenderResponse renderResponse)
		throws Exception {

		return "/configuration.jsp";
	}
foxmolder5 foxmolder5, modificado 15 Anos atrás.

RE: Add configuration tab to a Portlet

New Member Postagens: 14 Data de Entrada: 29/10/08 Postagens Recentes
yes.
this is the code:


	public String render(
			PortletConfig portletConfig, RenderRequest renderRequest,
			RenderResponse renderResponse)
		throws Exception {
		System.out.println("check");
		return "/html/portlet/ext/package_name/configuration.jsp";
	}


but i never see "check" showing.

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


	<portlet>
		<portlet-name>show_information_visual</portlet-name>
		<icon>/html/icons/default.png</icon>
		<display-name>Show Information Visual</display-name>
		<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
		<configuration-action-class>com.ext.portlet.packageName.action.ConfigurationActionImpl</configuration-action-class> 
		<init-param>
			<name>view-action</name>
			<value>/ext/package_name/view</value>
		</init-param>
		<expiration-cache>0</expiration-cache>
		<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
		<security-role-ref>
			<role-name>power-user</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>user</role-name>
		</security-role-ref>
	</portlet>


i don't know where error is.
thumbnail
Christianto Sahat, modificado 15 Anos atrás.

RE: Add configuration tab to a Portlet

Regular Member Postagens: 179 Data de Entrada: 25/09/07 Postagens Recentes
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



	<portlet>
		<portlet-name>8</portlet-name>
		<icon>/html/portlet/calendar/icon.png</icon>
		<struts-path>calendar</struts-path>
		<configuration-action-class>com.liferay.portlet.calendar.action.ConfigurationActionImpl</configuration-action-class>
		<scheduler-class>com.liferay.portlet.calendar.job.CalendarScheduler</scheduler-class>
		<portlet-data-handler-class>com.liferay.portlet.calendar.lar.CalendarPortletDataHandlerImpl</portlet-data-handler-class>
		<social-activity-interpreter-class>com.liferay.portlet.calendar.social.CalendarActivityInterpreter</social-activity-interpreter-class>
		<preferences-unique-per-layout>false</preferences-unique-per-layout>
		<use-default-template>false</use-default-template>
		<show-portlet-access-denied>true</show-portlet-access-denied>
		<show-portlet-inactive>true</show-portlet-inactive>
		<restore-current-view>false</restore-current-view>
		<private-request-attributes>false</private-request-attributes>
		<private-session-attributes>false</private-session-attributes>
		<render-weight>1</render-weight>
		<header-portlet-css>/html/portlet/calendar/css.jsp</header-portlet-css>
		<css-class-wrapper>portlet-calendar</css-class-wrapper>
</portlet>



foxmolder5 foxmolder5:


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


	<portlet>
		<portlet-name>show_information_visual</portlet-name>
		<icon>/html/icons/default.png</icon>
		<display-name>Show Information Visual</display-name>
		<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
		<configuration-action-class>com.ext.portlet.packageName.action.ConfigurationActionImpl</configuration-action-class> 
	</portlet>


i don't know where error is.
pop
thumbnail
Stanislav S., modificado 12 Anos atrás.

RE: Add configuration tab to a Portlet

New Member Postagens: 3 Data de Entrada: 19/04/12 Postagens Recentes
Apparently, after three years, I'm having the same problem.
No exceptions, no errors -- and also no "Setup" tab in preferences.

Liferay-portlet.xml

<portlet>
	<portlet-name>CustomPortlet</portlet-name>
	<icon>/icon.png</icon>
	<configuration-action-class>workbox.CustomPortlet.CustomConfigurationAction</configuration-action-class> 
	<instanceable>false</instanceable>
	<header-portlet-css>/css/main.css</header-portlet-css>
	<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
	<css-class-wrapper>CustomPortlet-portlet</css-class-wrapper>
</portlet>


CustomConfigurationAction.java:

public class CustomConfigurationAction implements com.liferay.portal.kernel.portlet.ConfigurationAction {
	@Override
	public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
			ActionResponse actionResponse) throws Exception {
	String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
		  if (!cmd.equals(Constants.UPDATE)) {
		      return;
		  }
		  System.out.println("Beep");
		 /* Lots of useless code */
	}

	@Override
	public String render(PortletConfig portletConfig, RenderRequest actionRequest,
			RenderResponse actionResponse) throws Exception {
		System.out.println("Beep");
		return "/html/configuration.jsp";
	}
}


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, modificado 11 Anos atrás.

RE: Add configuration tab to a Portlet

New Member Postagens: 20 Data de Entrada: 09/08/12 Postagens Recentes
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

<portlet>
	<portlet-name>CustomPortlet</portlet-name>
	<icon>/icon.png</icon>
	<configuration-action-class>workbox.CustomPortlet.CustomConfigurationAction</configuration-action-class> 
	<instanceable>false</instanceable>
	<header-portlet-css>/css/main.css</header-portlet-css>
	<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
	<css-class-wrapper>CustomPortlet-portlet</css-class-wrapper>
</portlet>


CustomConfigurationAction.java:

public class CustomConfigurationAction implements com.liferay.portal.kernel.portlet.ConfigurationAction {
	@Override
	public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
			ActionResponse actionResponse) throws Exception {
	String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
		  if (!cmd.equals(Constants.UPDATE)) {
		      return;
		  }
		  System.out.println("Beep");
		 /* Lots of useless code */
	}

	@Override
	public String render(PortletConfig portletConfig, RenderRequest actionRequest,
			RenderResponse actionResponse) throws Exception {
		System.out.println("Beep");
		return "/html/configuration.jsp";
	}
}


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,
&lt;%@ taglib uri="[[http://java.sun.com/portlet|http://java.sun.com/portlet]]" prefix="portlet" %&gt; &lt;%@ taglib uri="[[http://liferay.com/tld/portlet|http://liferay.com/tld/portlet]]" prefix="liferay-portlet" %&gt; &lt;%@ page import="com.liferay.portal.kernel.util.Constants" %&gt; 

To :
&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;


Refering here


Thanks,
Anson