Portlet API

WebSphere® Portal 支持使用 IBM® portlet API 的 portlet 和使用 JSR 168 portlet API 的 portlet。Rational® Developer 工具支持开发这两种类型的 portlet。本节为您提供了一些信息,用来决定在开发 portlet 时要使用哪个 API。

IBM portlet API

IBM portlet API 是 WebSphere Portal V4.x 最初支持的 portlet API,后续版本仍然会支持它。

JSR 168 portlet API

JSR 168 是 Java™ Community Process 的 Java 规范,它解决有关在门户网站环境中运行的 portlet 的聚集、个性化、表示和安全性需求。因为符合 JSR 168 规范的 Portlet 可以部署至任何符合 JSR 168 的门户网站,所以它们更便于移植和再使用。Rational Developer 支持基于 JSR 168 规范的 Faces portlet 开发。

IBM portlet API 扩展 servlet API 和许多主要接口(请求、响应和会话)。JSR 168 API 不扩展 servlet API,但具有许多相同特征。JSR 168 利用由 servlet 规范提供的许多功能,如部署、类载入、Web 应用程序、Web 应用程序生命周期管理、会话管理和请求分派。

决定使用哪个 API

对于新的 portlet,如果 JSR 168 提供的功能足以满足 portlet 的需要或者该 portlet 将作为 Web Service for Remote Portlets(WSRP)服务发布,则考虑使用 JSR 168。WSRP 是另一个基于门户网站的标准,用来将远程 portlet 的表示(作为 Web Service 提供)集成到本地门户网站页面中。已经协调了 JSR168 和 WSRP 中的概念,从而允许将 JSR 168 portlet 作为 Web Service 发布。部分这样的概念包括 portlet 方式和状态、URL 和名称空间编码以及处理瞬态和持久信息。如果 portlet 需要的功能比 JSR 168 所提供的功能要多,则应该使用 IBM portlet API。

有关 API 差别的其它信息可在教程库(帮助 > 教程库 > 边做边学)中的检查 portlet API 间的差别教程中找到。

有关 WebSphere Portal JSR 168 支持的未来方向

IBM 将在后续版本中为 JSR 提供更多增强功能,以使 JSR 168 portlet API 变得象当前的 IBM 等效件一样有用。IBM 已致力于在 WebSphere Portal(包括 JSR 168、JSP 标准标记库(JSTL)和 WSRP)中更广泛地采用开放式标准。

相关任务
创建 portlet 项目(IBM API)
创建 portlet 项目(JSR 168)
相关参考
WebSphere Portal Information Center
Comparing the JSR 168 Java Portlet Specification with the IBM Portlet API
Best practices: Developing portlets using JSR 168 and WebSphere Portal V5.02
JSR 168 Portlet Specification
Web Services for Remote Portlets
A Standard Tag Library for JavaServer Pages

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