1 error

用于显示操作失败的信息。使用"portlet-msg-error" CSS class。默认情况下,在红框里显示错误信息。

显示错误,(至少)需要以下两步:

1.      在后台处理程序中通过SessionErrors.add(req,key)设置key的值:

com.liferay.portal.kernel.servlet.SessionErrors.add(PortletRequestportletRequest, String key) 



2.      message指定显示信息对应的资源文件中key的值。key值必须唯一。

<liferay-ui:errormessage="message"key="key"/> 



示例:



2 message

Key为在资源文件中配置的值

示例:

3 tags-summary

4 journal-article

使用用户定义的模板显示journal article。

四个参数:

1. articleId = uniqueID of content article

2 .groupId = group of user

3. showTitle = show title of article trueor false

4 .templateId = which of the definedtemplates for this journal article to use. Note that there is a bug (reportedhere) in liferay versions before 6.0.2 where templateId is ignored.

示例:

<liferay-ui:journal-articlearticleId="<%=menuIdString%>" groupId="<%=groupId%>"/>  


5 bread-crumb

6 tabs

Liferay中自带的Tab标签UI,可以根据其name属性显示相应的标签名,多个标签名字用逗号分割, 但逗号前后都不能有多余空格。param参数是是tabs1还是tabsn,命名规范是tabsx,是几级菜单的标识。url是每个对应的name名字的要跳转的页面,最大支持10个标签名。



注:实际使用当中通过这种方式:

首先,从页面获取参数,也就是<liferay-ui:tabs 标签当中设置的param属性:

String cur=ParamUtil.getString(request,"cur","add"); 



第二个参数是设置的参数名,最后一个参数为你想要默认显示的页面。

其次定义url:

然后定义liferay-ui:tabs标签:

标签会传递相应的参数,然后选择显示要显示的页面。

另外,liferay的多tab页还可以通过下面这种方式实现:

首先定义url:

然后定义liferay-ui:tabs标签:

这样,就可以根据在names里面定义的顺序,显示所要显示的页面。

7 section

8 page-iterator

参数:(cur、curParam、total为必须参数)

1.      curParam指定保存当前页码的参数名称;

2.      curValue保存当前页码;

3.      delta指定每页显示的记录数量;

4.      maxPages指定Portlet正常模式下的显示的最大记录数;

5.      total指定数据的总记录数;

6.      url 指定翻页时的请求URL.

9 search-container

results- This is where you input the results. resultsshould be of type List. The important part is to make sure that your methodsupports some way to search from a beginning index to an end index in order toprovide a good performance pagination. Note how we usesearchContainer.getStart() for the first index and searchContainer.getEnd() forthe second index. As mentioned above, the searchContainer object is availablebecause it has been instantiated already. Some other methods you can use:

searchContainer.getStart() - gets starting index of current resultspage.

searchContainer.getResultsEnd() - gets ending index of currentresults page or index of last result (i.e. will return 3 if delta is 5 butthere are only 3 results).

searchContainer.getEnd() - gets last index of current results pageregardless of size of actually results (i.e. will return 5 if delta is 5 evenif there is only 3 results. Will throw out of bounds errors).

searchContainer.getCur() - gets number of current results page.

searchContainer.setTotal() - must be set so getResultsEnd() knowswhen to stop.

total- This is where you input the total number of itemsin your list

className - The type of Object in your List. In this case, we have a List ofUser objects.

keyProperty - Primary Key

modelVar - The name of the variable to represent your model. In this casethe model is the User object.

<liferay-ui:search-container-column-text> - Text column

name - Name of the column

value - Value of the column

href - the text in this coulmn will be a link the this URL

orderable - allows the user to order the list of items by this column

property - This will automatically look in the User object for the"firstName" property. It's basically the same thing asuser.getFirstName()

<liferay-ui:search-iterator/> - This is what actually iterates through anddisplays the List

示例:


  1.  
    searchTerms.getKeywords(),searchTerms.getActiveObj(),userParams);%>"/>
  2.  
    <liferay-ui:search-container-row
  3.  
    className="com.liferay.portal.model.User"
  4.  
    keyProperty="userId"
  5.  
    modelVar="user">
  6.  
    <liferay-ui:search-container-column-text
  7.  
    name="name"value="<%= user.getFullName()%>"/>
  8.  
    <liferay-ui:search-container-column-text
  9.  
    name="first-name"property="firstName"/>
  10.  
    </liferay-ui:search-container-row>
  11.  
    <liferay-ui:search-iterator/>
  12.  
    t;/liferay-ui:search-container>

官网UI:http://docs.liferay.com/portal/6.1/taglibs/liferay-ui/tld-summary.html
由一个网址: 
http://liferaydemystified.blogspot.com/2011/05/liferay-ui-taglib.html
02-14 00:35