I have a problem and i was wondering if anyone can help me. Any help is really appreciated. And i m sure that its an 'easy' question.
I have a jsp page that shows dynamic data in tables, my problem is that the page has multiple tables. But i want to export to excel only a specific table with a specific id.
So far i m exporting to excel all data from the jsp page which is wrong, cause i want to export only one table with id="formAssignDemands", how can i do it ?
Here is my code,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html;charset=windows-1253"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%> <f:view> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1253"/> <f:loadBundle basename="bundles.requests" var="FieldsDescr"/> <f:loadBundle basename="bundles.messages" var="GeneralMessages"/> <title> <h:outputText value="#{FieldsDescr.AssignRequests_Title}"/> </title> <a4j:loadStyle src="#{AssignDemands_backing.municipality.url}#{AssignDemands_backing.municipality.templateId}#{GeneralMessages.CssPath}"/> <script language="JavaScript" type="text/javascript" src="./demands.js"></script> <script language="JavaScript" type="text/javascript" src="../reports/reports.js"></script> </head> <body><h:form> <jsp:include page="/system/NavigationMenu.jsp"/> </h:form> <% String exportToExcel = request.getParameter("exportToExcel"); if (exportToExcel != null && exportToExcel.toString().equalsIgnoreCase("YES")) { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "inline; filename=" + "excel.xls"); } %> <table cellspacing="0" cellpadding="0" border="0" width="99%" align="center"> <tr> <td class="componentheading" width="99%"> <h:outputText value="#{FieldsDescr.AssignRequests_SubHeader}"/> </td> <td class="componentheading" width="1%"> <table> ...... <tr> <td class="main_component_seperator" colspan="2"> </td> </tr> <tr> <td align="center" colspan="2"> <h:form id="formAssignDemands"> <t:dataTable id="demandsDataTable" binding="#{AssignDemands_backing.demandsDataTable}" var="demand" value="#{AssignDemands_backing.unassignedDemandsList}" rows="#{NavigationMenu_backing.rows}" varDetailToggler="detailToggler" sortColumn="#{AssignDemands_backing.sort}" sortAscending="#{AssignDemands_backing.ascending}" preserveSort="true" headerClass="datatable_td_header" rowClasses="tablerow1, tablerow2" width="100%" rowIndexVar="demandsRowIndex"> <f:facet name="header"> <h:panelGroup> <f:verbatim> <div style="float:left;"></div> </f:verbatim> <h:panelGrid columns="4" cellspacing="2"> <h:outputText value="#{GeneralMessages.DataTable_RowsPerPage}"/> ..... </table> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <% if (exportToExcel == null) { %> <a href="AssignDemands.jsp?exportToExcel=YES">Export to Excel</a> <% } %> </body> </html> </f:view> <%-- oracle-jdev-comment:auto-binding-backing-bean-name:AssignRequests--%> Thank you guys for any help or any idea,,