如果在自定義標簽中獲取PortletRequest和PortletResponse
Posted on 2007-03-11 14:37 馬達+斯加 閱讀(688) 評論(0) 編輯 收藏 所屬分類: Websphere Portal在JSP開發(fā)過程中,我比較喜歡使用自定義標簽,但是在開發(fā)JSR168Portlet時,有時候需要在自定義標簽中使用PortletRequest, PortletRespose,如何取得這兩個東西呢?
//PortletRequest簡單
PortletRequest portletReqest = (PortletRequest) pageContext.getRequest();
//PortletResponse不能這樣干,會出ClassCaseException
PortletApiUtils portletUtils = PortletApiUtils.getUtilsInstance();
PortletResponse portletResponse = (PortletResponse) portletUtils.getPortletResponse((HttpServletRequest) pageContext.getRequest());
//PortletRequest簡單
PortletRequest portletReqest = (PortletRequest) pageContext.getRequest();
//PortletResponse不能這樣干,會出ClassCaseException
PortletApiUtils portletUtils = PortletApiUtils.getUtilsInstance();
PortletResponse portletResponse = (PortletResponse) portletUtils.getPortletResponse((HttpServletRequest) pageContext.getRequest());