阳光VIP

少壮不努力,老大徒伤悲。平日弗用功,自到临期悔。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

[Portal参考手册]Portlet描述文件

Posted on 2012-02-03 11:55  阳光VIP  阅读(218)  评论(0编辑  收藏  举报

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 对象取得