留言板

Add configuration tab to a Portlet

foxmolder5 foxmolder5,修改在15 年前。

Add configuration tab to a Portlet

New Member 帖子: 14 加入日期: 08-10-29 最近的帖子
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,修改在15 年前。

RE: Add configuration tab to a Portlet

Liferay Legend 帖子: 2047 加入日期: 08-10-7 最近的帖子
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,修改在15 年前。

RE: Add configuration tab to a Portlet

New Member 帖子: 14 加入日期: 08-10-29 最近的帖子
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,修改在15 年前。

RE: Add configuration tab to a Portlet

Regular Member 帖子: 179 加入日期: 07-9-25 最近的帖子
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.,修改在12 年前。

RE: Add configuration tab to a Portlet

New Member 帖子: 3 加入日期: 12-4-19 最近的帖子
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,修改在11 年前。

RE: Add configuration tab to a Portlet

New Member 帖子: 20 加入日期: 12-8-9 最近的帖子
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