Reputation: 95
I have to get ThemeDisplay() in web-content to compare page title. I am using <#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext()>
To get service context, but it's throwing freemarker exception mentioned below:
No error description was specified for this error; low-level message: java.lang.ClassNotFoundException: com.liferay.portal.kernel.service.ServiceContext cannot be found by com.liferay.portal.template.freemarker_2.0.29 ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign service = staticUtil["com.lif... [in template "20155#20195#54243" at line 21, column 1] ----
FYI: I already enabled freemarker engine setting in control panel freemarker engine. Also in portal-ext.properties file.
Upvotes: 0
Views: 2446
Reputation: 95
Thanks guys for your precious responses, I found that it's not working for me, because i am using embedded web-content. And in that case it's not working :)
Sorry for less explain in my question. Actually i didn't know that embedding web-content in theme is a different case.
Upvotes: 1
Reputation: 712
I just tried in my freemarker template the following:
<#assign
serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext() />
and it works as of Liferay 7 GA5. Are you sure you have correctly enabled the Freemarker variable? To verify:
freemarker
and hit enterstaticUtil
to something like nonExistent
(just removing brought it back for me afaik).portal-ext.properties
file. It's not necessary.How about now?
Upvotes: 3