Fórum

Struts Portlet Hook <portlet:renderURL> problem

Marian S, modificado 9 Anos atrás.

Struts Portlet Hook <portlet:renderURL> problem

New Member Mensagem: 1 Data de Entrada: 10/09/14 Postagens Recentes
I'm trying to create a Struts hook for journal_content portlet. I followed the steps from this tutorial https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/lp-6-1-dgen06-overriding-and-adding-struts-actions-0 and many many others.

But there's a problem when I try to create a <portlet:renderURL>. After clicking the submit button, it enters in the render method from my class which extends BaseStrutsPortletAction(tested by printing a message in console), but it doesn't rerender the portlet, instead some visual elements disappear and it doesn't recognize the content :

Before click :


After click :



And the link created after clicking submit is this : http://localhost:8080/web/guest/welcome?p_p_id=56_INSTANCE_NyzuEP7UGwg1&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=4&_56_INSTANCE_NyzuEP7UGwg1_struts_action=%2Fjournal_content%2Flike_action


This is the code for : view.jsp

 &lt;%@ include file="/html/portlet/journal_content/init.jsp"%&gt;
<liferay-util:buffer var="html">
	<liferay-util:include page="/html/portlet/journal_content/view.portal.jsp" />
</liferay-util:buffer>

&lt;%=html%&gt;

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

<portlet:renderurl var="testURL">
	<portlet:param name="struts_action" value="/journal_content/like_action" />
</portlet:renderurl>

<aui:button href="<%= testURL %>" value="TestButton" />


and in render method i only have :

@Override
	public String render(PortletConfig portletConfig,
			RenderRequest renderRequest, RenderResponse renderResponse)
			throws Exception {				
		System.out.println("It renders!");
		return "/portlet/journal_content/view.jsp";
	}



Does anybody know what I'm doing wrong? Thank you!