掲示板
Trying to add a new Struts action for Blog
10年前 に Juanjo Hernández Cánovas によって更新されました。
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年前 に Brian Russell によって更新されました。
RE: Trying to add a new Struts action for Blog
Junior Member 投稿: 41 参加年月日: 11/10/31 最新の投稿
Were you able to resolve your issue?
I am not having the same exact issue, but I am curious about your implementation. I am also attempting to add a new action to a built in portlet (shopping) and wondering where I put the struts-config action declaration? I do have an ext plugin with a struts-config-ext.xml, but I would think I could add something via the hook as well?
How did you declare your action-mapping? Or did you not have to?
Thank you!
Brian
I am not having the same exact issue, but I am curious about your implementation. I am also attempting to add a new action to a built in portlet (shopping) and wondering where I put the struts-config action declaration? I do have an ext plugin with a struts-config-ext.xml, but I would think I could add something via the hook as well?
How did you declare your action-mapping? Or did you not have to?
Thank you!
Brian
9年前 に Mika Koivisto によって更新されました。
RE: Trying to add a new Struts action for Blog
Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
You should be extending BaseStrutsPortletAction and not BaseStrutsAction which is for actions triggered under /c