使用 Faces 操作动态更改 portlet 方式

portlet 的方式可通过单击 portlet 标题栏上的对应图标来手工更改。但是,如果想要根据 Faces 操作的性能来更改 portlet 方式,则可以调用 Faces 操作中的适当 portlet API 方法来触发方式更改。
例如,可通过单击编辑方式页中的提交按钮来使编辑方式下的 portlet 转换为查看方式:
JSR 168 portlet API 示例
ActionResponse response = (ActionResponse)facesContext.getExternalContext().getResponse();
try {
     response.setPortletMode(PortletMode.VIEW);
} catch (PortletModeException e) {
     // Your exception handling code here
}
IBM® portlet API 示例
PortletRequest request = (PortletRequest)facesContext.getExternalContext().getRequest();
try {
	    request.setModeModifier(Portlet.ModeModifier.PREVIOUS);
} catch (AccessDeniedException e) {
	    // Your exception handling code here
}
相关概念
使用 Faces 组件的动态数据
创建 Faces portlet 和项目
相关任务
创建 Faces portlet JSP 文件
添加和更新现有 IBM portlet 的 Faces portlet 方式
添加和更新现有 JSR 168 portlet 的 Faces portlet 方式

(C) Copyright IBM Corporation 2002, 2005. All Rights Reserved.