Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
URL Parameter in Web Content
We are using Liferay DXP 7.0 and I was wondering if it is possible to have some web content on a page, that gets a URL parameter and appends that to a URL in our content. For example, lets say we havea page that has the below web content on the page:
Click here to go to our partner site.
When you intially come to the page, you would come to it with a guid in the URL, like www.xyz.com?guid=12345. In the web content above, I would like the "Click here" to be an actual link to another site (www.abc.com?guid=12345), and we pass the guid that was in our original page url.
Does anyone know how can this be done?
Thanks!
In the absense of a better way to do it, you could use the following code I think --
<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext()> <#assign httpServletRequest = serviceContext.getRequest()/>
That will give you the real request object. From there you should be able to use the portalUtil to get the original request object, query string and all. Out of curiosiy though, how are you linking to the page? and how is the GUID determined? If it something that is consistent, then it might be better to use a service to pull it from storage rather than use the approach I listed above.
Powered by Liferay™