Date: 十月 13th, 2009
Cate: develop
Tags:  

IBM Portal中从portal向portlet传参数的方法

虽然不是portlet规范中所定义的方法,但有的时候hack真的无法避免.以下方法在IBM Portal 6.1中测试通过.

先在portal(比如theme)中设置

request.setAttribute("testKey","testValue");

然后在portlet中使用

//用内部方法取得portal的http request

HttpServletRequest httpReq = com.ibm.wps.pe.pc.std.core.PortletUtils.getInternalRequest(portletRequest).getHttpServletRequest();

httpReq.getAttribute("testKey");

其实portletRequest.getAttribute(…)本身就包含很多好东西,甚至包含portal的session,只是取的方法很麻烦.

Leave a Reply

 Name

 Mail

 Home

[Name and Mail is required. Mail won't be published.]