This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Record not getting properly displayed in excel through java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Record not getting properly displayed in excel through java code" Watch "Record not getting properly displayed in excel through java code" New topic
Author

Record not getting properly displayed in excel through java code

juanschodiger jha
Greenhorn

Joined: Mar 25, 2012
Posts: 8
FoodCoupon cr_details = new FoodCoupon();
String company = request.getParameter("report");
allData = cr_details.getEmployees(pageContext,company);

int count=0;
count = allData.size();
int rowno = count/10;

if(allData.size()>0)
{
out.write("<table width=100% border=1 cellpadding=1 cellspacing=1>");
out.write("<tr>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"EMPLOYEE_ID"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"CARD_NUMBER"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"PAYROLL_CITY"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"PAYROLL_LOCATION"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"CURRENT_CITY"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"CURRENT_LOCATION"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"WAGETYPE"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"VENDOR"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"AMOUNT"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"DATE OF JOINING"+"</font></td>");
out.write("</table >");
out.write("<table width=100% border=1 cellpadding=1 cellspacing=1 >");

for (int counter=0;counter<rowno;counter++)
{
out.write("<tr>");
for (int i =0; i<10;i++)
{
out.write("<td>");
out.write(allData.get(counter*10+i).toString());
out.write("</td>");
}
out.write("</tr>");
}
out.write("</table>");


}


All records are not properly getting diaplayed in excel.After 6757 records nothing is getting dispalyed.
Please suggest how to resolve this error.Thank you.



[Thumbnail for attachment.JPG]

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Is this code in a JSP?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
juanschodiger jha
Greenhorn

Joined: Mar 25, 2012
Posts: 8
Yes above code is in jsp page...........i m not finding any reason why there is a split..
nagi ponnaganti
Greenhorn

Joined: Nov 22, 2009
Posts: 4
I'm really not sure what you are trying to do.. are you trying to display a table on the JSP page and after that copy all the data from the browser to paste it in excel?
if you want to create an xls from the data you have, you should probably go for apache poi jar where you would have more control on formatting cells.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

There should be no Java code in a JSP. Please read this JspFaq entry.

In particular, putting HTML inside Java inside a JSP is ludicrous! The whole purpose of JSP is so that the HTML markup can be part of the template text.
 
Consider Paul's rocket mass heater.
 
subject: Record not getting properly displayed in excel through java code
 
Similar Threads
Take the quiz: Which sci-fi crew would you fit best in?
HTML does not print properly - table width exceeding 100%?
Make rows not appear when certain row value appears
How many people share your name?
The requested resource (Servlet action is not available) is not available. ...