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