如何在Liferay速度模板中获取特定portlet的plid

时间:2014-02-18 04:14:18

标签: liferay-6 liferay-velocity

我正在开发MVC Portlet并希望通过Controller的菜单链接打开我的portlet的特定页面。 在速度模板中,我有我的portlet的portlet名称。

我怎么能得到那个portlet?

我的代码如下:

#if ($nav_item.getName().equalsIgnoreCase("specific menu link"))

#set ($myURL = $portletURLFactory.create($request,"portletname_WAR_portletnameportlet",$getterUtil.getLong($plid),"RENDER_PHASE"))
$myURL .setParameter("view","methodName") //Controller paramter
<a href="$myURL" > $nav_item.getName()</a>
#end

它将我的参数附加到当前网址并保持当前页面。

我已将我的portlet添加到另一个页面并尝试使用硬编码的plid,它运行正常,但对于不同的服务器,它会产生问题。

那么,如何在运行时在vm文件中获取我的portlet以便在创建URL时使用?

1 个答案:

答案 0 :(得分:0)

我们在配置中维护了一些其他地方.. 我可以给你提示一些东西在portlet首选项中存储PlId值。在port中通过portlet id获取portlet首选项..然后得到plid。

有时候portlet可能会放在很多页面中,所以我们可能会得到多个plid。

根据页面名称提取plid在所有门户网站上使用相同的页面名称。