Fórum

Export JSP to excel

thumbnail
Sravan Kumar Chalvadi, modificado 7 Anos atrás.

Export JSP to excel

New Member Postagens: 22 Data de Entrada: 13/01/16 Postagens Recentes
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 7 Anos atrás.

RE: Export JSP to excel

Expert Postagens: 252 Data de Entrada: 06/04/12 Postagens Recentes
This forum is for the AlloyUI Javascript framework.

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