In Liferay the object “ThemeDisplay” is kind of a god-object, it contains a lot of fields/methods that might be useful all around the portal.

All the data provided by this object is not especially related to Liferay themes, so if you are looking for a specific piece of data you should at least give a look to that object. You might find what you want in it.

Init of the ThemeDisplay instance

It could be useful to know how this god-object is generated, all the source code is available in the class com.liferay.portal.events.ServicePreAction, method initThemeDisplay.

ThemeDisplay in JSP

<liferay-theme:defineObjects />
<% 
themeDisplay.getUserId();
%>

(source of the tag: com.liferay.taglib.theme.DefineObjectsTag)

ThemeDisplay in Java controller

ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
            WebKeys.THEME_DISPLAY);

ThemeDisplay in Velocity (VM)

$themeDisplay.getUserId()

(added in Velocity context from this class: com.liferay.portal.velocity.VelocityVariablesImpl)

ThemeDisplay in Freemarker (FTL)

themeDisplay.getUserId()

(added in Freemarker context from this class: com.liferay.portal.freemarker.FreeMarkerVariablesImpl)