liferay标签

1、在web.xml中表明标签库,在JSP 的头部声明标签库调用< %@ taglib  uri = "http://java.sun.com/portlet"   prefix = "portlet"  % >

标签:

在使用Portlet 典型标签之前,要见声明<portlet:defineObjects/>,这样才可以使用其他的标签。defineObjects 中间不允许定义任何属性和包含任何内容

renderURL 标签

 属性   值类型 对应值

windowState string (minimized normal maximized)

portletMode  string (view edit help) var string (...)

secure  string (true false)

< portlet:renderURL   portletMode = "view"   windowState = "maximized" >   

< portlet:param   name = "number"   value = "1" />   

< portlet:param   name = "page"   value = "2" />   

</ portlet:renderURL >

创建一个当前ActionURL ,当访问它时将使Portlet  窗口变为正常状态,模式变为编辑。<Portlet:param/> 子元素会在生成的ActionURL  中增加action  参数和值。renderURL actionURL  两个标签在诸如生成form  表单的action  等方面特别有用。  

 

param 标签

用在renderURL actionURL  标签内部,用来在生成的URL  中增加参数和值。

namespace标签

为目前的Portlet  产生一个唯一的Value ,防止与其他Portlet  或者Portal  上面的Value  冲突。上述标签的具体属性及其约束, 请参阅${CATALINA_HOME}/liferay/WEB-INF/tld/liferay-portlet.tld

 

Here is an example how to use it in the code:

<script> function <portlet:namespace />myFunction() { alert("<portlet:namespace />myButton was clicked" ); } </script> <input type="button" id="<portlet:namespace />myButton" onclick="<portlet:namespace />myFunction();">
 

参考:http://www.liferay.com/zh/community/wiki/-/wiki/Main/Portlet+namespace;jsessionid=A9C06A6696B02766AC0D74956305DE12.node-1

liferay resourceURL标签

ResourceURL主要用作返回Portlet资源,比如js、css、swf文件,图片等

<img src="<portlet:resourceURL />" />
public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
    //output the image bytes here
}

参考:http://www.liferay.com/zh/community/forums/-/message_boards/message/943526

over

明天总结liferay权限管理

actionURL 标签

 属性   值类型 对应值

windowState string (minimized normal maximized)

portletMode  string (view edit help) var string (...)

secure  string (true false)

< portlet:actionURL   windowState = "normal"   PortletMode = "edit" >   

< portlet:param   name = "action"   value = "login" />   

</ portlet:actionURL >  

 创建一个当前RenderURL ,当访问它时将使Portlet  窗口变为最大化状态,模式变为浏览。<portlet:param/> 子元素会在生成的RenderURL  中增加numberpage  两个参数和值。

defineObjects 标签

<liferay-theme:defineObjects/>标签,该标签对应的DefineObjectsTag就是将很多liferay的变量放到pageContext

<Portlet:DefineObjects>标签,将会在页面得到下列对象JSR 168 (Portlet 1.0)

In JSR 168 only three variables are defined:

* RenderRequest renderRequest
* RenderResponse renderResponse
* PortletConfig portletConfig

JSR 268 (Portlet 2.0)

In JSR 286 following variables are defined:

* RenderRequest renderRequest and RenderResponse renderResponse (if the JSP is included from render method)
* ResourceRequest resourceRequest and ResourceResponse resourceResponse (if the JSP is included from serveResource method)
* ActionRequest actionRequest and ActionResponse actionResponse (if the JSP is included from processAction method)
* EventRequest eventRequest and EventResponse eventResponse (if the JSP is included from processEvent method)
* PortletConfig portletConfig
* PortletSession portletSession (returns an existing session or null if no session exists)
* Map<String, Object> portletSessionScope (provides access to the portletSession attributes)
* PortletPreferences portletPreferences (provides access to the portlet preferences)
* Map<String, String[]> portletPreferencesValues (provides access to the portlet preferences as a Map)

 参考  http://calvinliu.iteye.com/blog/1026565

猜你喜欢

转载自xijunhu.iteye.com/blog/1121825
今日推荐