Fórum

calling custom attributes

V Rao, modificado 14 Anos atrás.

calling custom attributes

Junior Member Postagens: 47 Data de Entrada: 08/02/08 Postagens Recentes
Hi,

I want to print custom attributes (I have custom attributes called 'bio' and 'department' in the directory portlet. what is the syntax/method for calling them?

-v
thumbnail
Peter Mesotten, modificado 14 Anos atrás.

RE: calling custom attributes

Junior Member Postagens: 45 Data de Entrada: 04/02/09 Postagens Recentes
Use the <liferay-ui:custom-attribute-list> tag in the proper JSP.
For example, if you would like to display a user's custom attributes you would do:

<liferay-ui:custom-attribute-list
className="com.liferay.portal.model.User"
classPK="<%= (selUser != null) ? selUser.getUserId() : 0 %>"
editable="<%= true %>"
label="<%= true %>"
/>

You have to know:
  • The class name: in your case this is com.liferay.portlet.documentlibrary.model.DLFolder
  • The id of the current directory. Mostly the current object is available in the JSP, so you can just call getFolderId() on it
  • Editable specifies if the values should be editable (duh)
  • If you set Label to false, no labels will be printed
V Rao, modificado 14 Anos atrás.

RE: calling custom attributes

Junior Member Postagens: 47 Data de Entrada: 08/02/08 Postagens Recentes
Peter Mesotten:
Use the <liferay-ui:custom-attribute-list> tag in the proper JSP.
For example, if you would like to display a user's custom attributes you would do:

<liferay-ui:custom-attribute-list
className="com.liferay.portal.model.User"
classPK="<%= (selUser != null) ? selUser.getUserId() : 0 %>"
editable="<%= true %>"
label="<%= true %>"
/>

You have to know:
  • The class name: in your case this is com.liferay.portlet.documentlibrary.model.DLFolder
  • The id of the current directory. Mostly the current object is available in the JSP, so you can just call getFolderId() on it
  • Editable specifies if the values should be editable (duh)
  • If you set Label to false, no labels will be printed


Hi,

Thanks for the tip. I am not sure I understand how a custom user attribute is related to document library? 'bio' is just a custom attribute (text field) I have created using control panel->users
V Rao, modificado 14 Anos atrás.

RE: calling custom attributes

Junior Member Postagens: 47 Data de Entrada: 08/02/08 Postagens Recentes
V Rao:
Peter Mesotten:
Use the <liferay-ui:custom-attribute-list> tag in the proper JSP.
For example, if you would like to display a user's custom attributes you would do:

<liferay-ui:custom-attribute-list
className="com.liferay.portal.model.User"
classPK="<%= (selUser != null) ? selUser.getUserId() : 0 %>"
editable="<%= true %>"
label="<%= true %>"
/>

You have to know:
  • The class name: in your case this is com.liferay.portlet.documentlibrary.model.DLFolder
  • The id of the current directory. Mostly the current object is available in the JSP, so you can just call getFolderId() on it
  • Editable specifies if the values should be editable (duh)
  • If you set Label to false, no labels will be printed


Hi,

Thanks for the tip. I am not sure I understand how a custom user attribute is related to document library? 'bio' is just a custom attribute (text field) I have created using control panel->users



This code works in details.jsp :

<liferay-ui:custom-attribute
className="<%= User.class.getName() %>"
classPK="<%= selUser != null ? selUser.getUserId() : 0 %>"
editable="<%= false %>"
label="<%= true %>"
name="Bio"
/>

If I want to add it in the listing itself (I assume search_columns.jspf) , it doesn't work.
Baris Sener, modificado 14 Anos atrás.

RE: calling custom attributes

Expert Postagens: 278 Data de Entrada: 23/06/09 Postagens Recentes
How can I check for the value of a custom attribute?

Baris
thumbnail
Krati Gupta, modificado 13 Anos atrás.

RE: calling custom attributes

Regular Member Postagens: 119 Data de Entrada: 05/12/08 Postagens Recentes
I want to Add Location as a custom attribute , and also want to the this custom attribute as a searchble .

As in a directory portlet , advanced search option I want to add one more option Location form which user will be searchable .

Please help me how can I achive this and what all files need to changed for that .
thumbnail
Muradali Hasan, modificado 13 Anos atrás.

RE: calling custom attributes

Junior Member Postagens: 84 Data de Entrada: 27/07/10 Postagens Recentes
Krati Gupta:
I want to Add Location as a custom attribute , and also want to the this custom attribute as a searchble .

As in a directory portlet , advanced search option I want to add one more option Location form which user will be searchable .

Please help me how can I achive this and what all files need to changed for that .



FOr that u need to customize directory portlet as per ur need

u need to chenge portal impl methods and custom sql for searching criteria

but convenient way is u overide existing methods of portalimpl package and define ur new custom query

and from jsp serch call ur own method instead existing method
thumbnail
prabhakar m, modificado 13 Anos atrás.

RE: calling custom attributes

New Member Postagens: 5 Data de Entrada: 12/01/11 Postagens Recentes
plz tel me the compleate steps to get user id in jsp portlet.. plz help me...emoticonemoticonemoticon
thumbnail
Muradali Hasan, modificado 13 Anos atrás.

RE: calling custom attributes

Junior Member Postagens: 84 Data de Entrada: 27/07/10 Postagens Recentes
Hi prabhakar m


plz tel me the compleate steps to get user id in jsp portlet.. plz help me...


use this
<liferay-theme:defineObjects />


then if u want user id of login user then just get using


<%=themeDisplay.getUserId()%>
thumbnail
prabhakar m, modificado 13 Anos atrás.

RE: calling custom attributes

New Member Postagens: 5 Data de Entrada: 12/01/11 Postagens Recentes
hello friends im new to liferay
how to display user id in a jsp page in liferay...plz help me.... thanks
thumbnail
Krati Gupta, modificado 13 Anos atrás.

RE: calling custom attributes

Regular Member Postagens: 119 Data de Entrada: 05/12/08 Postagens Recentes
hi ,

use user.getUuid() function to get user id in jsp .
thumbnail
prabhakar m, modificado 13 Anos atrás.

RE: calling custom attributes

New Member Postagens: 5 Data de Entrada: 12/01/11 Postagens Recentes
i got dis error wile runnig jsp


org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 1 in the jsp file: /user.jsp
user cannot be resolved
1: <%=user.getUuid()%>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:126)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)