Templates 如何在Liferay中使用操作按钮为动态列表开发列表模板?

Templates 如何在Liferay中使用操作按钮为动态列表开发列表模板?,templates,liferay,velocity,Templates,Liferay,Velocity,我已经读过这篇文章,也读过另一篇webapplicationdeveloper博客文章,但没有找到任何想法,可以在动态数据列表的自定义应用模板中获取操作按钮 我还尝试在vm模板中包含dynamicdatalist portlet的默认记录\u action.jsp,但它不起作用,还设置了下面的属性 journal.template.velocity.restricted.variables = 在门户ext属性中,我仍然无法在自定义模板中获得操作按钮 我已经试过了: # set ( $cat

我已经读过这篇文章,也读过另一篇webapplicationdeveloper博客文章,但没有找到任何想法,可以在动态数据列表的自定义应用模板中获取操作按钮

我还尝试在vm模板中包含dynamicdatalist portlet的默认记录\u action.jsp,但它不起作用,还设置了下面的属性

journal.template.velocity.restricted.variables = 
在门户ext属性中,我仍然无法在自定义模板中获得操作按钮

我已经试过了:

#
set (
$categoriesService = $portal.getClass().forName("com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil").getMethod("getService", null).invoke(null, null))

My answer is: Yessss, it works. But I want use a jstl lib (e.g. <aui> or <ui>) as well. In my opinion the simpliest way to do it is include jsp file to themeServletContext. Put your file.jsp into your theme:

your-theme/docroot/path/to/your/jsp/file.jsp

and paste this piece of code into your vm (for example portal_normal.vm):
$theme.include($themeServletContext, "/path/to/your/jsp/file.jsp")
#
设置(
$categoriesService=$portal.getClass().forName(“com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil”).getMethod(“getService”,null).invoke(null,null))
我的答案是:是的,它是有效的。但我也希望使用jstl库(例如or)。在我看来,最简单的方法是将jsp文件包含到MeservletContext中。将file.jsp放入主题中:
您的主题/docroot/path/to/your/jsp/file.jsp
并将这段代码粘贴到您的vm中(例如portal_normal.vm):
$theme.include($themeServletContext,“/path/to/your/jsp/file.jsp”)
在这种情况下,它无法找到$theme变量my page,该变量按原样显示$theme。:(
请帮助:

离开velocity,它太差了,无法使用taglib,切换到freemaker语言:taglib更强大、更全面的支持

这里有一个使用freemaker进行主题开发的示例,但它也是在动态数据列表中创建模板的良好起点


看看freemaker指南:

你尝试了一种非常错误的方法来解决你的问题。你是否同时解决了这个问题,或者它仍然是一个悬而未决的问题?不,你有什么想法吗?