Skip to content Skip to sidebar Skip to footer

Couldn't Get The Values From Jsp To Servlet

If I run jsp, while exporting the contents to excel, I am not getting the values in downloaded excel file. It is simply empty. Here what I tried.. How to pass the table values to s

Solution 1:

Try this:

<%@ page language="java" contentType="application/vnd.ms-excel"
pageEncoding="ISO-8859-1"%>
 <%@ page import ="javax.swing.JOptionPane"%>   
<!DOCTYPE htmlPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1"><title>Export to Excel - Demo</title></head><body><tablealign="left"border="2"><thead><trbgcolor="lightgreen"><th>Sr. No.</th><th>Text Data</th><th>Number Data</th></tr></thead><tbody>
        <%
            for (int i = 0; i < 10; i++) {
        %>
        <trbgcolor="lightblue"><tdalign="center"><%=i + 1%></td><tdalign="center">This is text data <%=i%></td><tdalign="center"><%=i * i%></td></tr>
        <%
            }
        %>
    </tbody></table><p>
fsfndfkdsfdkfjsfksfskfsfskfsfksfskf
dfkdjfkfksfkkkkkkkkkjjjjjjjjj
</p><ahref="Sample?exportToExcel=YES">Export to Excel</a>

Post a Comment for "Couldn't Get The Values From Jsp To Servlet"