liferay-ui:discussion with custom portlet(MVCPortlet / Liferay 6.1)
Add the below code in view.jsp
<%
WindowState windowState = null;
PortletMode portletMode = null;
PortletURL currentURLObj = null;
if (renderRequest != null) {
windowState = renderRequest.getWindowState();
portletMode = renderRequest.getPortletMode();
currentURLObj = PortletURLUtil.getCurrent(renderRequest, renderResponse);
} else if (resourceRequest != null) {
windowState = resourceRequest.getWindowState();
portletMode = resourceRequest.getPortletMode();
currentURLObj = PortletURLUtil.getCurrent(resourceRequest, resourceResponse);
}
String currentURL = currentURLObj.toString();
%>
Add the below invokeTaglibDiscussion method in YourPortletClass. java
public void invokeTaglibDiscussion(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
PortletConfig portletConfig = getPortletConfig();
PortalClassInvoker .invoke(true, "com.liferay.portlet.messageboards.action.EditDiscussionAction",
"processAction", new String[] {
"org.apache.struts.action.ActionMapping",
"org.apache.struts.action.ActionForm",
PortletConfig.class.getName(),
ActionRequest.class.getName(),
ActionResponse.class.getName()
}, null, null, portletConfig, actionRequest, actionResponse);
}
Add the below code in view.jsp
<%
WindowState windowState = null;
PortletMode portletMode = null;
PortletURL currentURLObj = null;
if (renderRequest != null) {
windowState = renderRequest.getWindowState();
portletMode = renderRequest.getPortletMode();
currentURLObj = PortletURLUtil.getCurrent(renderRequest, renderResponse);
} else if (resourceRequest != null) {
windowState = resourceRequest.getWindowState();
portletMode = resourceRequest.getPortletMode();
currentURLObj = PortletURLUtil.getCurrent(resourceRequest, resourceResponse);
}
String currentURL = currentURLObj.toString();
%>
Add the below invokeTaglibDiscussion method in YourPortletClass. java
public void invokeTaglibDiscussion(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
PortletConfig portletConfig = getPortletConfig();
PortalClassInvoker .invoke(true, "com.liferay.portlet.messageboards.action.EditDiscussionAction",
"processAction", new String[] {
"org.apache.struts.action.ActionMapping",
"org.apache.struts.action.ActionForm",
PortletConfig.class.getName(),
ActionRequest.class.getName(),
ActionResponse.class.getName()
}, null, null, portletConfig, actionRequest, actionResponse);
}