• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP/HTML to Excel

 
brisk rook
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anyone help me fixing this.
I have a JSP application. The front end is in JSp & there's one main/central JSP which handles the user requests & manipultes them in the backend & responds back to the browser.
There is one webpage in which a table is displayed(based on users request). There is an option in the page to save this table as an EXcel spreadsheet. Till this point everything's ok, but when the table is being saved as an Excel then the values of few columns are abruptly getting changed(different from the values displayed in the webpage).
can anyone come out with a solution/suggestion..??
 
Raph Kuriyan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how are you writing to the excel file? If you're using jdbc dbc then there should be no problem on that front. The problem may lie in the data that is read by your jsp/servlet that is doing the conversion.
if you're using jdbc dbc to write to a particular excel file and then redirecting to this file, then you may have problems with other threads modifying the physical excel file on disk before you the user starts the download.

Originally posted by brisk rook:
Hi,
Can anyone help me fixing this.
I have a JSP application. The front end is in JSp & there's one main/central JSP which handles the user requests & manipultes them in the backend & responds back to the browser.
There is one webpage in which a table is displayed(based on users request). There is an option in the page to save this table as an EXcel spreadsheet. Till this point everything's ok, but when the table is being saved as an Excel then the values of few columns are abruptly getting changed(different from the values displayed in the webpage).
can anyone come out with a solution/suggestion..??

 
brisk rook
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI raph,
Thanx for your response. Infact we are using JDBC. The problem here's this is an application already being deevloped by someone else. I took over him after he left & i really need to rush up the things to fix this. U know how difficult would it be to get into someone's code & understand it.MOreover there's hardly any comments given in the code.. Would you plz suggest me a quickest way to locate jsp/servlet which does the conversion. I looked at a jsp file named saveTable.jsp which does this. but there's nothing significant in this..here's the code.

<% /**
Description:
Send table as tab-delimited text so browser
will prompt user to open or save.
*/ %><%@ taglib uri="jdeep.tld" prefix="jlb" %><%
response.setContentType("application/vnd.ms-excel");
String tableModel = request.getParameter("tableModel");
if(tableModel == null | | "".equals(tableModel) | |
"com.objx.protex.view.CETable".equals(tableModel)) {
tableModel = "com.objx.protex.view.RETable";
}
Object table = "table"; //hack for Tomcat3.2.1 bug: can't cast String to Object
%><jlb:createTable
id="table"
input="<%= tableModel %>"
scope="session"
sortable="true"
resetSortOrder="false"
force="true"
/><jlb:viewTable
table="<%= table %>"
tableFormat="tab"
applyFormats="false"
/>

would plz suggest me as to how i should go about it...???
Originally posted by Raph Kuriyan:
how are you writing to the excel file? If you're using jdbc dbc then there should be no problem on that front. The problem may lie in the data that is read by your jsp/servlet that is doing the conversion.
if you're using jdbc dbc to write to a particular excel file and then redirecting to this file, then you may have problems with other threads modifying the physical excel file on disk before you the user starts the download.


 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, what you have there is a custom tag that can take a set of model data and format it as a set of rows of tab-delimited data, which is one of Excel's available import formats. Not sure how to explain modified data - the model data either comes in from the URL or, if not supplied there is evidently synthesized. Your problem MAY be that the tag's not threadsafe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic