Forums de discussion
[Solved] Trying to add a new Struts action for Blog
Juanjo Hernández Cánovas, modifié il y a 10 années.
[Solved] Trying to add a new Struts action for Blog
Regular Member Publications: 183 Date d'inscription: 11/08/08 Publications récentes
Hello,
I'm trying to add a new Struts Action for the Blog. I have made a hook for this new behaviour following the "how to" http://www.liferay.com/es/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins. All seems to works ok, but when I call the new action from a jsp I get this exception:
The hook's code is:
liferay-hook.xml
ShareNotificacionAction Action class
The hooked jsp view_entry_content.jsp
I have seen the forum entry https://www.liferay.com/es/community/forums/-/message_boards/message/13487363, but this solution doesn't work for me.
Thanks in advanced for your help.
Greetz,
Juanjo.
I'm trying to add a new Struts Action for the Blog. I have made a hook for this new behaviour following the "how to" http://www.liferay.com/es/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins. All seems to works ok, but when I call the new action from a jsp I get this exception:
ERROR [http-bio-8080-exec-126][status_jsp:665] java.lang.ClassCastException: com.liferay.portal.struts.ActionAdapter cannot be cast to com.liferay.portal.struts.PortletActionAdapter
java.lang.ClassCastException: com.liferay.portal.struts.ActionAdapter cannot be cast to com.liferay.portal.struts.PortletActionAdapter
The hook's code is:
liferay-hook.xml
<hook>
<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
<struts-action>
<struts-action-path>/blogs/share_notificacion</struts-action-path>
<struts-action-impl>
com.pymoo.hook.blogs.action.ShareNotificacionAction
</struts-action-impl>
</struts-action>
</hook>
ShareNotificacionAction Action class
public class ShareNotificacionAction extends BaseStrutsAction {
private static final Log log = LogFactory.getLog(ShareNotificacionAction.class);
public String execute(HttpServletRequest request, HttpServletResponse response)
throws Exception {
log.info("Inside Share notificacion Action");
return "/portal/sample.jsp";
}
}
The hooked jsp view_entry_content.jsp
<%@include file="/html/portlet/blogs/init.jsp" %>
<liferay-util:buffer var="html">
<liferay-util:include page="/html/portlet/blogs/view_entry_content.portal.jsp" useCustomPage="<%= false %>" />
</liferay-util:buffer>
<%= html %>
<portlet:actionurl var="shareNotificacionURL">
<portlet:param name="struts_action" value="/blogs/share_notificacion" />
</portlet:actionurl>
<div id="<portlet:namespace />share_notificacion">
<aui:a cssClass="share" href="<%= shareNotificacionURL %>" label="share" />
</div>
I have seen the forum entry https://www.liferay.com/es/community/forums/-/message_boards/message/13487363, but this solution doesn't work for me.
Thanks in advanced for your help.
Greetz,
Juanjo.
Mika Koivisto, modifié il y a 10 années.
RE: Trying to add a new Struts action for Blog
Liferay Legend Publications: 1519 Date d'inscription: 07/08/06 Publications récentes
You are extending wrong class. When dealing with portlet struts action you need to extend BaseStrutsPortletAction instead of BaseStrutsAction which is used for paths under /c
Juanjo Hernández Cánovas, modifié il y a 10 années.
RE: Trying to add a new Struts action for Blog
Regular Member Publications: 183 Date d'inscription: 11/08/08 Publications récentes
Hello Mika,
Thank you for your response. I tried this solution before withour good results, but it works just making a forced deploy of the hook. It doesn't works with the autodeploy on liferay sdk.
Thank you very much!
Juanjo
Thank you for your response. I tried this solution before withour good results, but it works just making a forced deploy of the hook. It doesn't works with the autodeploy on liferay sdk.
Thank you very much!
Juanjo
Juanjo Hernández Cánovas, modifié il y a 10 années.
RE: Trying to add a new Struts action for Blog
Regular Member Publications: 183 Date d'inscription: 11/08/08 Publications récentes
Hi Mika,
Now I'm facing a "Forward does not exist" error. Could you guide me?
Thanks in advanced,
Juanjo.
Now I'm facing a "Forward does not exist" error. Could you guide me?
Thanks in advanced,
Juanjo.
Juanjo Hernández Cánovas, modifié il y a 10 années.
RE: Trying to add a new Struts action for Blog
Regular Member Publications: 183 Date d'inscription: 11/08/08 Publications récentes
Hi one more time :-)
Digging on forum and wiki I have modified the render function to:
And now the error is
with the same result.
Any tip or advice?
Thanks in advanced,
Juanjo.
Digging on forum and wiki I have modified the render function to:
return originalStrutsPortletAction.render( originalStrutsPortletAction, portletConfig, renderRequest, renderResponse);
And now the error is
10:43:42,257 ERROR [http-bio-8080-exec-90][render_portlet_jsp:154] java.lang.NullPointerException
with the same result.
Any tip or advice?
Thanks in advanced,
Juanjo.
Roman Pelegin, modifié il y a 9 années.
RE: Trying to add a new Struts action for Blog
New Member Publications: 6 Date d'inscription: 17/02/14 Publications récentes
Hello Juanjo!
Did you solved this problem?
I faced with the same thing and I have no idea what the problem.
Did you solved this problem?
I faced with the same thing and I have no idea what the problem.