Hello,
I need themeDisplay from Liferay into backing bean. I am getting null. Anyone has a clue ?
Here is code:
javax.portlet.PortletRequest req = (javax.portlet.PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
RenderRequest renderRequest =(RenderRequest)req.getAttribute("javax.portlet.request");;
ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY);
Thanks
PS:
EXAMPLE PORTLET:
Here is a simple portlet that works fine:
<f:view
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:liferay-faces="http://liferay.com/tld/faces"
xmlns:liferay-security="http://liferay.com/tld/security"
xmlns:liferay-theme="http://liferay.com/tld/theme"
xmlns:liferay-ui="http://liferay.com/tld/ui">
<liferay-theme:defineObjects /> -- ADDING THIS MAKES AN EXCEPTION
<ice:outputDeclaration doctypeRoot="HTML"
doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
doctypeSystem="http://www.w3.org/TR/html4/transitional.dtd" />
<ice:portlet styleClass="componentBoxPortlet">
<ice:outputStyle href="/xmlhttp/css/rime/rime-portlet.css" />
<ice:outputStyle href="./css/showcase_style.css" />
<ice:panelGroup>
<ice:outputConnectionStatus style="float:right;" />
<ice:panelGroup id="treeContentPanel" style="float:left;">
<ice:form>
<ice:panelGroup styleClass="exampleBox">
<ice:outputText value="#{companyInfo.greeting}"/>
</ice:panelGroup>
</ice:form>
</ice:panelGroup>
<ice:panelGroup styleClass="clearer" />
</ice:panelGroup>
</ice:portlet>
</f:view>
EXCEPTION:
Exception: Unsuported, bla bla bla...
aused by: javax.faces.FacesException: Failed to execute JSP lifecycle.
at com.icesoft.faces.webapp.parser.Parser.parse(Parser.java:175)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:504)
... 156 more
Caused by: java.lang.UnsupportedOperationException
at com.icesoft.faces.webapp.parser.StubHttpServletRequest.getAttribute(StubHttpServletRequest.java:116)
at com.liferay.taglib.theme.DefineObjectsTag.doStartTag(DefineObjectsTag.java:42)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:198)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:222)
at com.icesoft.faces.webapp.parser.Parser.parse(Parser.java:159)
... 157 more
16:07:51,986 ERROR [jsp:52] java.lang.UnsupportedOperationException
at com.icesoft.faces.webapp.parser.StubHttpServletRequest.getAttribute(StubHttpServletRequest.java:116)
at com.liferay.taglib.theme.DefineObjectsTag.doStartTag(DefineObjectsTag.java:42)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:198)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:222)
at com.icesoft.faces.webapp.parser.Parser.parse(Parser.java:159)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:504)
LET ME KNOW IF I AM ON WRONG TRACK GO GET THEME FROM BACKING BEAN. DO I NEED THIS TAG THERE? ALSO EXCEPTION DISAPEARS IF I CHANGE <PORTLET-CLASS> IN PORTLET.XML
PORTLET.XML
<portlet>
<portlet-name>CompanyHeader</portlet-name>
<display-name>Company Header</display-name>
<portlet-class>com.icesoft.faces.webapp.http.portlet.MainPortlet</portlet-class>
<init-param>
<name>com.icesoft.faces.portlet.viewPageURL</name>
<value>/Test.iface</value>
</init-param>
Please help.
Firmi prego dentro per inbandierare questo come inadeguato.