001
014
015 package com.liferay.portlet.messageboards.action;
016
017 import com.liferay.portal.kernel.util.ParamUtil;
018 import com.liferay.portal.util.PortalUtil;
019 import com.liferay.portal.util.PortletKeys;
020 import com.liferay.portlet.PortletURLImpl;
021
022 import javax.portlet.PortletMode;
023 import javax.portlet.PortletRequest;
024 import javax.portlet.PortletURL;
025 import javax.portlet.WindowState;
026
027 import javax.servlet.http.HttpServletRequest;
028 import javax.servlet.http.HttpServletResponse;
029
030 import org.apache.struts.action.Action;
031 import org.apache.struts.action.ActionForm;
032 import org.apache.struts.action.ActionForward;
033 import org.apache.struts.action.ActionMapping;
034
035
038 public class FindRecentPostsAction extends Action {
039
040 @Override
041 public ActionForward execute(
042 ActionMapping actionMapping, ActionForm actionForm,
043 HttpServletRequest request, HttpServletResponse response)
044 throws Exception {
045
046 try {
047 long plid = ParamUtil.getLong(request, "p_l_id");
048
049 PortletURL portletURL = new PortletURLImpl(
050 request, PortletKeys.MESSAGE_BOARDS, plid,
051 PortletRequest.RENDER_PHASE);
052
053 portletURL.setWindowState(WindowState.NORMAL);
054 portletURL.setPortletMode(PortletMode.VIEW);
055
056 portletURL.setParameter("struts_action", "/message_boards/view");
057 portletURL.setParameter("tabs2", "recent-posts");
058
059 response.sendRedirect(portletURL.toString());
060
061 return null;
062 }
063 catch (Exception e) {
064 PortalUtil.sendError(e, request, response);
065
066 return null;
067 }
068 }
069
070 }