掲示板
[Solved] Trying to add a new Struts action for Blog
10年前 に Juanjo Hernández Cánovas によって更新されました。
[Solved] Trying to add a new Struts action for Blog
Regular Member 投稿: 183 参加年月日: 08/08/11 最新の投稿
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.
10年前 に Mika Koivisto によって更新されました。
RE: Trying to add a new Struts action for Blog
Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
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
10年前 に Juanjo Hernández Cánovas によって更新されました。
RE: Trying to add a new Struts action for Blog
Regular Member 投稿: 183 参加年月日: 08/08/11 最新の投稿
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
10年前 に Juanjo Hernández Cánovas によって更新されました。
RE: Trying to add a new Struts action for Blog
Regular Member 投稿: 183 参加年月日: 08/08/11 最新の投稿
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.
10年前 に Juanjo Hernández Cánovas によって更新されました。
RE: Trying to add a new Struts action for Blog
Regular Member 投稿: 183 参加年月日: 08/08/11 最新の投稿
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.
9年前 に Roman Pelegin によって更新されました。
RE: Trying to add a new Struts action for Blog
New Member 投稿: 6 参加年月日: 14/02/17 最新の投稿
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.