hashtable
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, March 6, 2008 01:24 PM

In this code I am retriving the data from database and putting in hastable and trying to display excel format. Problem here I couldn't get the colnames with out.print(ht.get(hdrCnt)). I am getting nulls.what is the solution to get the names using hashtable ? ht = da.getInfoForTheDay(cat,day,mon,year); response.setContentType("application/vnd.ms-excel"); PrintWriter out = new PrintWriter(response.getWriter()); // Specify default name for MS Excel document to save as String expFileName = "exportfilename.xls"; response.setHeader( "Content-Disposition", "attachment;filename=" + expFileName + ""); Enumerati   More>>

In this code I am retriving the data from database and putting in hastable and trying to display excel format.

Problem here I couldn't get the colnames with out.print(ht.get(hdrCnt)). I am getting nulls.what is the solution to get the names using hashtable ?




ht = da.getInfoForTheDay(cat,day,mon,year);
response.setContentType("application/vnd.ms-excel");
PrintWriter out = new PrintWriter(response.getWriter());

// Specify default name for MS Excel document to save as
String expFileName = "exportfilename.xls";
response.setHeader(
"Content-Disposition",
"attachment;filename=" + expFileName + "");

Enumeration en = ht.elements();

int colCnt = ht.size();
int hdrCnt;
for(hdrCnt =1; hdrCnt <=colCnt; hdrCnt++)
{
if(hdrCnt>1){
out.print(" ");
}
out.print(ht.get(hdrCnt));
System.out.println("Colname:"+en.nextElement());

}
out.print("
");



Please let me know ASAP. It is very urgent.

thanks

   <<Less
About | Sitemap | Contact