Portlet.xml概要描述
来源:互联网 发布:黑马程序员开班时间 编辑:程序博客网 时间:2024/06/07 10:04
一,Porlet.xml具体格式
<portlet>
<portlet-name>jsp-portlet</portlet-name>
<display-name>JSP Portlet</display-name>
<portlet-class>com.sample.jsp.portlet.JSPPortlet</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>JSP Portlet</title>
<short-title>JSP Portlet</short-title>
<keywords>JSP Portlet</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
二,Portlet各标签的含义
portlet-name The portlet-name element contains the canonical name of the portlet. Each portlet name is unique within the portlet application. (This is also referred within Liferay Portal as the portlet id)
portlet-name就像是portlet的Id,必须唯一
display-name The display-name type contains a short name that is intended to be displayed by tools. It is used by display-name elements. The display name need not be unique.
portlet-class The portlet-class element contains the fully qualified class name of the portlet.
需要的Portlet实现对应的Class
init-param The init-param element contains a name/value pair as an initialization param of the portlet.
expiration-cache Expiration-cache defines expiration-based caching for this portlet. The parameter indicates the time in seconds after which the portlet output expires. -1 indicates that the output never expires.
缓存过期的时间
supports The supports element contains the supported mime-type. Supports also indicates the portlet modes a portlet supports for a specific content type. All portlets must support the view mode.
portlet-info Portlet-info defines portlet information.
security-role-ref
The security-role-ref element contains the declaration of a security role reference in the code of the web application. Specifically in Liferay, the role-name references which role’s can access the portlet.
(A Power User can personalize the portal, whereas a User cannot.)
三,Portlet.xml示例
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd /opt/SUNWportal/dtd/portlet.xsd"
version="2.0">
<portlet>
<portlet-name>testportal</portlet-name>
<display-name>Sample JSP</display-name>
<portlet-class>test.portlet.MyPortlet</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>myfirstportal</title>
<short-title>myfirstportal</short-title>
<keywords>myfirstportal</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>
本文参考了liferay Portal 5.0的Development文档。
- Portlet.xml概要描述
- Liferay-portlet.xml概要解释
- [Portal参考手册]Portlet描述文件
- [Portal参考手册]Portlet描述文件
- [Portal参考手册]4.Portlet描述文件
- [Portal参考手册]4.Portlet描述文件
- 各种图像格式的概要描述
- 18-概要与描述标签
- javax.portlet.PortletException: java.lang.NoSuchMethodException portlet.xml
- XML技术概要
- XML 技术概要
- XML技术概要
- XML基础入门概要
- XML学习概要
- portlet
- Portlet
- Portlet
- Portlet
- 给VS2005的编辑器添加右边界线
- [你必须知道的.NET] 第一回:恩怨情仇:is和as
- vmware-vmx.exe进程CPU占用率100%解决方法
- java页面抓取代码
- 在Windows下编译sqlite3生成动态链接库并使用
- Portlet.xml概要描述
- 根据数据库内现有字段更新某张表
- 根据一定判断条件更新数据库内某张表,
- 网站防止注入
- 解决firefox不能播放flash问题
- asp.net的postback机制 (转自http://www.cnblogs.com/KenBlove/archive/2008/11/06/1328238.html)
- ASP.NET对路径"xxxxx"的访问被拒绝的解决方法
- 倒霉
- 优秀网站源码、编程源码下载网站大集中 (转)