Portlet描述文件通过portlet.xml文件定义application portlet和conrete portlet。这一节将介绍portlet.xml的定义。
Portlet描述文件有下面的结构:
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app-collection>
<!--[if !vml]--><!--[endif]-->
<portlet-app-def> <!--[if !vml]--><!--[endif]-->
<portlet-app ...>
<!--[if !vml]--><!--[endif]-->
<concrete-portlet-app ...>
<!--[if !vml]--><!--[endif]-->
<concrete-portlet-app ...>
</portlet-app-def>
</portlet-app-collection>
<!--[if !vml]--><!--[endif]-->
portlet-app-collection定义portlet的集合
<!--[if !vml]--><!--[endif]-->
portlet-app-def定义了application porlet和多个conrete portlet
<!--[if !vml]--><!--[endif]-->
portlet-app提供了一个application portlet的定义
<!--[if !vml]--><!--[endif]-->
concrete-portlet-app提供了一个concrete portlet的定义
一个具体portlet定义了conrete portlet的属性。一个application portlet可以有多个conrete portlet。
<concrete-portlet-app id="org.myorganization.portlets.myportlet.1"> <!--[if !vml]--><!--[endif]-->
<context-param> <!--[if !vml]--><!--[endif]-->
<param-name>buzzle</param-name>
<param-value>yea</param-value>
</context-param>
<concrete-portlet> <!--[if !vml]--><!--[endif]-->
<portlet-name>Hello World 1</portlet-name> <!--[if !vml]--><!--[endif]-->
<default-locale>en</default-locale> <!--[if !vml]--><!--[endif]-->
<language locale="en_US"> <!--[if !vml]--><!--[endif]-->
<title>Hello World - Sample Portlet #1</title> <!--[if !vml]--><!--[endif]-->
<title-short>Hello World</title-short> <!--[if !vml]--><!--[endif]-->
<description>Here is a simple portlet</description> <!--[if !vml]--><!--[endif]-->
<keywords>portlet hello world</keywords> <!--[if !vml]--><!--[endif]-->
</language>
<language locale="zh_CN">
<title>您好#1</title>
<title-short>您好 </title-short>
<description>久违了</description>
<keywords>问候</keywords>
</language>
<allowed-access visibility="PRIVATE" role="ADMIN"/> <!--[if !vml]--><!--[endif]-->
<config-param> <!--[if !vml]--><!--[endif]-->
<param-name>a config parameter</param-name>
<param-value>a config value</param-value>
</config-param>
</concrete-portlet>
</concrete-portlet-app>
<!--[if !vml]--><!--[endif]-->
Id是conrete portlet的指示符,由application portlet Id加上一个整数组成。一般来说,由1开始递增
<!--[if !vml]--><!--[endif]-->
(可选)定义了portlet context信息,由PortletApplicationSettings 对象封装
<!--[if !vml]--><!--[endif]-->
concrete portlet,用作产生PortletSettings对象
<!--[if !vml]--><!--[endif]-->
(可选)conrete portlet的指示符
<!--[if !vml]--><!--[endif]-->
(可选) 缺省的locale
<!--[if !vml]--><!--[endif]-->
(可选) 其他的locale
<!--[if !vml]--><!--[endif]-->
(可选)title
<!--[if !vml]--><!--[endif]-->
(可选) 更简短的title,可以被用作WML设备上显示
<!--[if !vml]--><!--[endif]-->
(可选) 摘要
<!--[if !vml]--><!--[endif]-->
(可选) 关键字
<!--[if !vml]--><!--[endif]-->
(可选) 定义了用户浏览这个portlet的时候的可视化属性。Allowed 的值有两个 PRIVATE 和PUBLIC. Role属性哪个角色可以访问这个portlet。 可用的值是在PortletRole 对象中定义的值
<!--[if !vml]--><!--[endif]-->
附加的concrete portlet 设置,可以通过PortletSettings 对象取得
分享到:
相关推荐
【描述】:“WebSphere Portal开发手册”是一份详尽的指导文档,旨在帮助开发者理解和实践在WebSphere Portal环境中的各种开发任务。手册涵盖了从基础设置到高级功能的方方面面,为开发者提供了丰富的实例和最佳实践...
2. **JSR268中文参考手册.pdf** - 这是JSR268规范的中文版,为开发者提供了关于如何遵循Portlet 2.0 API进行开发的官方指南。手册可能包括API接口、示例代码和最佳实践,帮助中国开发者理解并实施portlet标准。 3. ...
- **portlet开发参考手册**:Portlet是LifeRay中的核心组件,用于展示动态内容和交互功能。这个参考手册可能详细介绍了portlet的生命周期、开发过程和集成方法。 综合来看,这些资源对于想要学习和精通LifeRay开发...
【标题】:“Portal” 【描述】:“SoftPortal Good” ...JSR168作为portlet开发的标准,为构建这样的平台提供了基础,而JSR168 PORTLET标准手册汉化整理.doc则是开发者深入了解和实践这一标准的重要参考资料。
- **定义**:部署描述符是一个XML文件,用于配置Portlet的各种属性和行为。 - **内容**:包括Portlet的名称、版本、依赖库、初始化参数等。 #### 3. **Portlet概念** - **核心概念**:Portlet的基本单元包括...