Monday 15 October 2012

Reading URL Parameters in Liferay template

Problem: Reading URL parameters that are passed to a page in web content display portlet.

Solution: Create a template for your web content and read url parameters in the template.

#set ($current_url = $request.get("attributes").CURRENT_COMPLETE_URL)
#set ($paramName='articleId')
#set ($articleId = $httpUtil.getParameter($current_url, $paramName))

In the above code we are trying to read url paramter articleId. Example URL is http://localhost:8080/web/carlovers/myhome?articleId=10740

No comments:

Post a Comment