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 public ActionForward execute(
041 ActionMapping mapping, ActionForm form, HttpServletRequest request,
042 HttpServletResponse response)
043 throws Exception {
044
045 try {
046 long plid = ParamUtil.getLong(request, "p_l_id");
047
048 PortletURL portletURL = new PortletURLImpl(
049 request, PortletKeys.MESSAGE_BOARDS, plid,
050 PortletRequest.RENDER_PHASE);
051
052 portletURL.setWindowState(WindowState.NORMAL);
053 portletURL.setPortletMode(PortletMode.VIEW);
054
055 portletURL.setParameter("struts_action", "/message_boards/view");
056 portletURL.setParameter("tabs2", "recent-posts");
057
058 response.sendRedirect(portletURL.toString());
059
060 return null;
061 }
062 catch (Exception e) {
063 PortalUtil.sendError(e, request, response);
064
065 return null;
066 }
067 }
068
069 }