Forums de discussion

Primefaces 5.1/Liferay 6.2 - dataExporter not working

RAjasekhara Kammari, modifié il y a 7 années.

Primefaces 5.1/Liferay 6.2 - dataExporter not working

New Member Publications: 6 Date d'inscription: 01/08/16 Publications récentes
Getting below exception while exporting the datatable to excel. I see related thread on this topic, but it is not useful, So posting it again.


SEVERE: Servlet.service() for servlet Phonebook Servlet threw exception
javax.portlet.faces.BridgeException: java.lang.IllegalArgumentException: application/vnd.ms-excel is an unsupported content type
at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:91)
at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:112)
at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:255)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:204)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:604)
at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:677)
at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:379)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1242)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
at com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:655)
at com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:138)
at com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141)
at com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126)
at com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:120)
thumbnail
Juan Gonzalez, modifié il y a 7 années.

RE: Primefaces 5.1/Liferay 6.2 - dataExporter not working

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
RAjasekhara Kammari:
Getting below exception while exporting the datatable to excel. I see related thread on this topic, but it is not useful, So posting it again.


Can you ellaborate on "it is not useful"? What steps you did take to fix the issue and why it wasn't useful.

Thanks.
RAjasekhara Kammari, modifié il y a 7 années.

RE: Primefaces 5.1/Liferay 6.2 - dataExporter not working

New Member Publications: 6 Date d'inscription: 01/08/16 Publications récentes
Thanks for your reply juan... I am trying to print primefaces Data table in excel format. Below is the code... configured mime-type in portlet.xml and web.xml as well, in backing bean...
public void postProcessXLS(Object document) {
PortletResponse portletResponse = (PortletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
HttpServletResponse httpServletResponse = com.liferay.portal.util.PortalUtil.getHttpServletResponse(portletResponse);
httpServletResponse.setContentType("application/vnd.ms-excel");
}
in xhtml... also tried using <h:commandButton>, dint work for me.
<h:commandLink immediate="true" style="float:right;">
<p:graphicImage url="/images/excel.png" width="20" />
<p:dataExporter type="xls" target="dt1" fileName="PhoneBookData" postProcessor="#{phd.postProcessXLS}"/>
</h:commandLink>
in portlet.xml....
<supports>
<mime-type>application/vnd.ms-excel</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
can you please suggest me why liferay is not supporting application/excel content type, is there any configuration that i'm missing out apart from portlet.xml and web.xml.
thumbnail
Juan Gonzalez, modifié il y a 7 années.

RE: Primefaces 5.1/Liferay 6.2 - dataExporter not working

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Which Liferay Faces version are you using?
RAjasekhara Kammari, modifié il y a 7 années.

RE: Primefaces 5.1/Liferay 6.2 - dataExporter not working

New Member Publications: 6 Date d'inscription: 01/08/16 Publications récentes
I am using liferay 6.2, liferay faces 3.2.4 and JSF 2.1
thumbnail
Juan Gonzalez, modifié il y a 7 années.

RE: Primefaces 5.1/Liferay 6.2 - dataExporter not working

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Ok, please can you upgrade your Liferay Faces version to 3.2.5-GA6? It should be fixed there.

Additionaly, in order to avoid both versions to be in the same webapp when hot deploying, you'd have to undeploy the previous version first.

Hope it helps...
RAjasekhara Kammari, modifié il y a 7 années.

RE: Primefaces 5.1/Liferay 6.2 - dataExporter not working

New Member Publications: 6 Date d'inscription: 01/08/16 Publications récentes
Thanks Juan, it worked after adding patch jar to ivy. and upgraded Liferay Faces version to 3.2.5-GA6 as well emoticon