留言板

How to add Application Display Template in custom portlet in liferay 7?

thumbnail
Abhishek Jain,修改在7 年前。

How to add Application Display Template in custom portlet in liferay 7?

Regular Member 帖子: 226 加入日期: 16-8-20 最近的帖子
I made a custom portlet and tried to configure adt for it but I am getting a missing dependency as Unresolved requirement:Import-Package: com.liferay.portlet.expando.model .I have tried with many versions of portal-service.jar but the status remains as it is( i.e installed rather than active).
This happens when I add configuration.jsp in my project. The code for configuration.jsp is as follows:-
<%@page import="com.liferay.portal.kernel.util.Constants"%>
<%@page import="com.liferay.portal.util.PortalUtil"%>
<%@ include file="init.jsp" %>
<%@page import="com.example.model.CustomUser4"%>
<%@page import="com.liferay.portal.kernel.template.TemplateHandlerRegistryUtil"%>
<%@page import="com.liferay.portal.kernel.template.TemplateHandler"%>
<liferay-portlet:actionURL portletConfiguration="true" var="configurationURL" />
<aui:form action="<%= configurationURL %>" method="post" name="fm">
<aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" />

<aui:fieldset>
<div class="display-template">

<%
TemplateHandler templateHandler = TemplateHandlerRegistryUtil.getTemplateHandler(CustomUser4.class.getName());

%>

<liferay-ui:ddm-template-selector
classNameId="<%= PortalUtil.getClassNameId(templateHandler.getClassName()) %>"
displayStyle="<%= displayStyle %>"
displayStyleGroupId="<%= displayStyleGroupId %>"
refreshURL="<%= PortalUtil.getCurrentURL(request) %>"
showEmptyOption="<%= true %>"
/>
</div>
</aui:fieldset>
<aui:button type="submit" name="submit"></aui:button>
</aui:form>


I am following this tutorial-https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/implementing-application-display-templates
Please help. Any help would be appreciated.
thumbnail
Abhishek Jain,修改在7 年前。

RE: How to add Application Display Template in custom portlet in liferay 7?

Regular Member 帖子: 226 加入日期: 16-8-20 最近的帖子
I resolved this problem somehow. But I got another error as follows:-
No tag "ddm-template-selector" defined in tag library imported with prefix "liferay-ui"
Can anyone help me to get rid of this error?
Guy Kouam,修改在7 年前。

RE: How to add Application Display Template in custom portlet in liferay 7?

New Member 帖子: 4 加入日期: 14-4-24 最近的帖子
Hello Abhishek ,

did you solved this Problem?
I am also struggling with the same issue since hours.
Please help...
srushti patel,修改在6 年前。

RE: How to add Application Display Template in custom portlet in liferay 7?

New Member 帖子: 4 加入日期: 17-1-19 最近的帖子
Use <liferay-ddm:template-selector> tag instead of <liferay-ui:ddm-template-selector> tag .
It will Solved the exception.

 <liferay-ddm:template-selector classNameId="<%= YourEntity.class.getName() %>" displayStyle="<%= displayStyle %>" displayStyleGroupId="<%= displayStyleGroupId %>" refreshURL="<%= PortalUtil.getCurrentURL(request) %>" showEmptyOption="<%= true %>" />
srushti patel,修改在6 年前。

RE: How to add Application Display Template in custom portlet in liferay 7?

New Member 帖子: 4 加入日期: 17-1-19 最近的帖子
srushti patel:
Use <liferay-ddm:template-selector> tag instead of <liferay-ui:ddm-template-selector> tag .
It will Solved the exception.

 <liferay-ddm:template-selector classNameId="<%= YourEntity.class.getName() %>" displayStyle="<%= displayStyle %>" displayStyleGroupId="<%= displayStyleGroupId %>" refreshURL="<%= PortalUtil.getCurrentURL(request) %>" showEmptyOption="<%= true %>" />



Solved issue but I can\t get ADT template list using this.
Cristian Simone,修改在5 年前。

RE: How to add Application Display Template in custom portlet in liferay 7?

New Member 发布: 1 加入日期: 16-10-12 最近的帖子

Did you solved this? I have the same problem. I did all the configurations.

But i get an empty ADT list in my configuration.jsp page.

 

Hope you can help me

Fateme Akbari,修改在3 年前。

RE: How to add Application Display Template in custom portlet in liferay 7?

New Member 帖子: 2 加入日期: 20-6-24 最近的帖子
hi, you have to add the below line to your Gradle file:
compileOnly group: "com.liferay", name: "com.liferay.dynamic.data.mapping.taglib", version: "4.0.0"

and this tag <%@taglib uri="http://liferay.com/tld/ddm" prefix="liferay-ddm" %> in your jsp file

I hope it helps you