Foros de discusión

How to create new Action in the Liferay 6.06

thumbnail
me liferay, modificado hace 11 años.

How to create new Action in the Liferay 6.06

Junior Member Mensajes: 25 Fecha de incorporación: 14/12/11 Mensajes recientes
I want to create one extra action for the documents of document library portlet.
After 6.0 SP2 it is possible to create it by hook but I do not know how to create it in 6.0.6 version.
What I have tried is as follow

Added entry for action directly in the struct-config.xml file(I know it is not best practice)
<action path="/document_library/subscribe_file_entry" type="com.sample.hook.dl.action.SubscribFileEntryAction">
			<forward name="portlet.document_library.subscribe_file_entry" path="portlet.document_library.subscribe_file_entry" />
			<forward name="portlet.document_library.error" path="portlet.document_library.error" />
		</action>

In JSP
	<c:if test="<%= showActions &amp;&amp; DLFileEntryPermission.contains(permissionChecker, fileEntry, ActionKeys.UPDATE) %>">
				<portlet:renderurl var="subscribeURL">
					<portlet:param name="struts_action" value="/document_library/subscribe_file_entry" />
					<portlet:param name="redirect" value="<%= currentURL %>" />
					<portlet:param name="folderId" value="<%= String.valueOf(fileEntry.getFolderId()) %>" />
					<portlet:param name="name" value="<%= HtmlUtil.unescape(fileEntry.getName()) %>" />
				</portlet:renderurl>

				<liferay-ui:icon image="edit" url="<%= subscribeURL %>" />
			</c:if>


Created this class SubscribFileEntryAction which entends com.liferay.portal.struts.PortletAction class
but when I deploy the hook I am able to see the action but when I click on that action it throws following error
java.lang.ClassNotFoundException: com.sample.hook.dl.action.SubscribFileEntryAction
(but It is there in the my deployed hook I can see the class file for that class)
Juan Francisco Ramos, modificado hace 11 años.

RE: How to create new Action in the Liferay 6.06

New Member Mensajes: 7 Fecha de incorporación: 1/06/10 Mensajes recientes
Hello!

To create a new functionality for an original portlet, you must use hooks or ext-portlets. Please look the documentation of hooks, for example:

Hooks

I hope I have helped you ;)