天天看點

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" οnclick="<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  中增加number 、page  兩個參數和值。

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