Last active
January 22, 2022 14:35
-
-
Save pavelfomin/282dd597d4e88678866d to your computer and use it in GitHub Desktop.
Get the http request parameters in Liferay from the freemarker web content template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#-- | |
The request here is not the original request and doesn't contain the url query parameters | |
hence the usage of the serviceContext from ServiceContextThreadLocal. | |
--> | |
<#assign serviceContext = staticUtil["com.liferay.portal.service.ServiceContextThreadLocal"].getServiceContext()> | |
<#assign httpServletRequest = serviceContext.getRequest()> | |
myparam="${(httpServletRequest.getParameter('myparam')?html)!''}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#-- | |
The request here is not the original request and doesn't contain the url query parameters hence the url parsing. | |
--> | |
<#assign url = request.attributes['CURRENT_URL']> | |
myparam = ${httpUtil.getParameter(url, "myparam", false)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very nice man