Forums de discussion

Liferay hook question

Anonyme, modifié il y a 14 années.

Liferay hook question

Envoyer: 1
Hi,

Is it possible to have two versions of a portlet simultaneously on Liferay: one with JSP hook and the other one without it?
For example I'd like to change JSP files in out-of-box Calendar portlet using hook, but I'd like to have the original portlet on my Liferay too.
Is it possible or do I need to use EXT to do it?
thumbnail
Albert J Carter-Corbin, modifié il y a 14 années.

RE: Liferay hook question

Regular Member Publications: 123 Date d'inscription: 12/09/06 Publications récentes
I think the only way to do that is to copy the source (jsp files) of the orginal portlet, make the changes to it and deploy it as a new portlet. You can use the same business objects (objects created with service builder) but use an updated user interface (jsp files).
thumbnail
Wilson Man, modifié il y a 14 années.

RE: Liferay hook question

Liferay Master Publications: 581 Date d'inscription: 21/06/06 Publications récentes
yeah, i agree with Albert's point. You probably would want to "clone" the portlet the way Albert described.
thumbnail
Raj K, modifié il y a 13 années.

RE: Liferay hook question

Regular Member Publications: 214 Date d'inscription: 19/06/09 Publications récentes
Albert J Carter-Corbin:
I think the only way to do that is to copy the source (jsp files) of the orginal portlet, make the changes to it and deploy it as a new portlet. You can use the same business objects (objects created with service builder) but use an updated user interface (jsp files).


Hey Albert,

I want to clone a out-of-box portlet(Asset Publisher) in 5.2.2.

I included all the jsps for that portlet and modified the portlet.xml, web.xml and struts-config.xml files

I am getting lots of errors when i hot deploy this portlet developed using plugins-sdk

Errors like:-
2010-05-12 13:20:01,167 INFO  [STDOUT] 13:20:01,167 WARN  [PortletHotDeployListener:677] Can't find bundle for base name com.liferay.portlet.StrutsResourceBundle, locale en_US
2010-05-12 13:20:01,183 INFO  [STDOUT] 13:20:01,183 ERROR [PortletHotDeployListener:596] java.lang.ClassCastException: com.liferay.portlet.PortletConfigImpl cannot be cast to com.liferay.portlet.PortletConfigImpl
java.lang.ClassCastException: com.liferay.portlet.PortletConfigImpl cannot be cast to com.liferay.portlet.PortletConfigImpl
	at com.liferay.portlet.StrutsPortlet.init(StrutsPortlet.java:175)

java.lang.NoClassDefFoundError: org/apache/lucene/store/jdbc/JdbcStoreException
	at com.liferay.portal.events.StartupAction.run(StartupAction.java:84)


I have not included any java files in my portlet. I have modified the liferay-plugin-package.properties files and added:-

portal-dependency-jars=\
portal-impl.jar,\
portal-kernel.jar,\
portal-service.jar,\
commons-lang.jar,\
commons-digester.jar,\
commons-collections.jar,\
commons-beanutils.jar


Please suggest what could be the error.

This is my portlet.xml:-

<!--?xml version="1.0"?-->

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">

	<portlet>
		<portlet-name>struts-plugin</portlet-name>
		<display-name>Asset Publisher</display-name>
		
		<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
		
		<!--
			<portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-class>
		-->
		<init-param>
			<name>ViewPage</name>
				<value>/asset_publisher/view.do</value>
			</init-param>
		<!--
		<init-param>
			<name>view-action</name>
			<value>/asset_publisher/view</value>
		</init-param>
		-->
		<init-param>
			<name>ServletContextProvider</name>
			<value>com.liferay.util.bridges.struts.LiferayServletContextProviderWrapper</value>
		</init-param>
		<expiration-cache>0</expiration-cache>
		<supports>
			<mime-type>text/html</mime-type>
		</supports>
		<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
		<portlet-info>
			<title>Asset Publisher</title>
		</portlet-info>	
		<security-role-ref>
			<role-name>guest</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>power-user</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>user</role-name>
		</security-role-ref>
		<supported-public-render-parameter>folksonomy</supported-public-render-parameter>
		<supported-public-render-parameter>tag</supported-public-render-parameter>
	</portlet>

	<public-render-parameter>
		<identifier>folksonomy</identifier>
		<qname xmlns:x="http://www.liferay.com/public-render-parameters">x:folksonomy</qname>
	</public-render-parameter>
	<public-render-parameter>
		<identifier>tag</identifier>
		<qname xmlns:x="http://www.liferay.com/public-render-parameters">x:tag</qname>
	</public-render-parameter>
	<public-render-parameter>
		<identifier>nodeId</identifier>
		<qname xmlns:w="http://www.liferay.com/public-render-parameters/wiki">w:nodeId</qname>
	</public-render-parameter>
	<public-render-parameter>
		<identifier>title</identifier>
		<qname xmlns:w="http://www.liferay.com/public-render-parameters/wiki">w:title</qname>
	</public-render-parameter>
	<container-runtime-option>
		<name>javax.portlet.escapeXml</name>
		<value>false</value>
	</container-runtime-option>

</portlet-app>


This is my web.xml:-

<!--?xml version="1.0" encoding="UTF-8"?--> 


<web-app>
	<servlet>
			<servlet-name>Main Servlet</servlet-name>
			<!--
			<servlet-class>com.liferay.util.bridges.struts.LiferayPortletServlet</servlet-class>
			-->
			<servlet-class>com.liferay.portal.servlet.MainServlet</servlet-class>
			<init-param>
				<param-name>config</param-name>
				<param-value>/WEB-INF/struts-config.xml</param-value>
			</init-param>
			<init-param>
				<param-name>debug</param-name>
				<param-value>0</param-value>
			</init-param>
			<init-param>
				<param-name>detail</param-name>
				<param-value>0</param-value>
			</init-param>
			<load-on-startup>1</load-on-startup>
	</servlet>
	
	<servlet-mapping>
		<servlet-name>Main Servlet</servlet-name>
		<url-pattern>/c/*</url-pattern>
	</servlet-mapping>
	
	<!--
	<servlet-mapping>
		<servlet-name>Main Servlet</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>
	-->

	<jsp-config>
		<taglib>
			<taglib-uri>http://displaytag.sf.net</taglib-uri>
			<taglib-location>/WEB-INF/tld/displaytag.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://java.sun.com/jstl/core_rt</taglib-uri>
			<taglib-location>/WEB-INF/tld/c-rt.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://java.sun.com/jstl/fmt_rt</taglib-uri>
			<taglib-location>/WEB-INF/tld/fmt-rt.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://java.sun.com/jstl/sql_rt</taglib-uri>
			<taglib-location>/WEB-INF/tld/sql-rt.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://java.sun.com/jstl/xml_rt</taglib-uri>
			<taglib-location>/WEB-INF/tld/x-rt.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
			<taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://liferay.com/tld/portlet</taglib-uri>
			<taglib-location>/WEB-INF/tld/liferay-portlet-ext.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://liferay.com/tld/security</taglib-uri>
			<taglib-location>/WEB-INF/tld/liferay-security.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://liferay.com/tld/theme</taglib-uri>
			<taglib-location>/WEB-INF/tld/liferay-theme.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://liferay.com/tld/ui</taglib-uri>
			<taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://liferay.com/tld/util</taglib-uri>
			<taglib-location>/WEB-INF/tld/liferay-util.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-bean</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-bean-el</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-bean-el.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-html</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-html-el</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-html-el.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-logic</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-logic-el</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-logic-el.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-nested</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-tiles</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>http://struts.apache.org/tags-tiles-el</taglib-uri>
			<taglib-location>/WEB-INF/tld/struts-tiles-el.tld</taglib-location>
		</taglib>
	</jsp-config>
</web-app>
mikel basabe, modifié il y a 12 années.

RE: Liferay hook question

New Member Publications: 21 Date d'inscription: 27/04/11 Publications récentes
Hi,

Im trying to clone the "journal_content" portlet of liferay, but I have a problem. My portlet uses struts-config.xml file from Root.war directory, instead of using the struts-config.xml file from my portlet which is located in Myportet/WEB-INF/. Any idea of what its happening?

Thanks in advance.

Bye.