Foros de discusión

Export JSP to excel

thumbnail
Sravan Kumar Chalvadi, modificado hace 7 años.

Export JSP to excel

New Member Mensajes: 22 Fecha de incorporación: 13/01/16 Mensajes recientes
Hi,

I want to export complete JSP which has mostly labels (elements) to an excel. I tried creating resource URL (in JSP) and serveResource() (in controller).


<portlet:resourceurl var="exportToExcelURL">
  <portlet:param name="mvcPath" value="/service_notification_report.jsp" />
</portlet:resourceurl>


@Override
	public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
			throws IOException, PortletException {
		System.out.println("serve resource");
		resourceResponse.setContentType("application/vnd.ms-excel");
		resourceResponse.setProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\""+ "excel.xls" + "\"");
		super.serveResource(resourceRequest, resourceResponse);
	}


This is resulting an excel sheet with out lables text.

Thanks!
thumbnail
Byrån Zaugg, modificado hace 7 años.

RE: Export JSP to excel

Expert Mensajes: 252 Fecha de incorporación: 6/04/12 Mensajes recientes
This forum is for the AlloyUI Javascript framework.

You may get more help from the Liferay Portal Development Forum .