I'm trying to create a link in a Liferay template using Velocity.
My code is the following, based on several examples on the net:
#set ($plid = $getterUtil.getLong($request.get('theme-display').get('plid')))
#set ($u = $portletURLFactory.create($request,"1",$plid,"RENDER_PHASE"))
$u.setParameter("struts_action","/asset_publisher/applyForJob");
<a href="$u">yyy</a>
I get the plid value, but my URL will be just ending with $u, it seems that the $portletURLFactory.create()
method is not properly interpreted.
Any ideas? Thank you!
Are you trying to do this inside Web Content Template? In that case it will not work because you do not have access to the real http request object. You need to create this link using javascript instead. Here is a code snippet.