aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Error in excel sending additional request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Error in excel sending additional request " Watch "Error in excel sending additional request " New topic
Author

Error in excel sending additional request

sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi

I am using a servlet to open an excel report which has multiple sheets . But there is a weird problem when i try to open an excel report with two sheets having the same name .

Generally when an excel with same sheet names is opened with Microsoft excel , it will open the excel file with a dialog showing error .

But when i am trying to open through a servlet after that open/save dialog box comes , its sending two requests and that too the second one from another browser . How i am saying that its sending from another browser is , during the second time its not passing the session checks which i placed .....I mean the session for the request doesn't have any data while it was expected to have some data which i placed in Session while logging in .

Can any one let me know why this is happening ?/
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Servlets have no built in capability to work directly with Excel files.
Are you using a 3rd party API?
If so, you might want to make that known when you post your questions.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi ben

I do agree what u asked for ?? But i have an excel file which is imported from some other system(mean to say its just copying from some fileserver) and i am trying to open those excel files using a servlet(i mean to say here its an action class in struts)

when the excel has two sheets which are of the same name , generally it will give an error . But the strange thing is that excel is sending again the request(which is the servlet call URL) and that too it appears like its sending from another browser
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by sreenath reddy:
i am trying to open those excel files using a servlet


Servlets can not open Excel files.
You would need a 3rd party API to do this.
Are you using one? If so, which one?

If I am misreading your question, you might need to post some code to make things clearer.
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi ben

Sorry for the trouble .Its actually Struts which is internally servlet again . I am opening the excel file by directly by using new ActionForward(path) where path is the ExcelfilePath in the server .

My code looks like this

public class OpenExcelAction extends Action
{
public ActionForward execute(req,res..)
{
// Check for session if the user is valid
response.setContentType("application/vnd.ms-excel");

return new ActionForward(filePath);

}
}



The problem here is its coming to the action class twice and the first time its trying to open the excel file and on some error its sending another request ...but second time its not able to pass that session check as the request appears like coming from entirely different browser .

Hope i am clear . Once again thanks for the concern u have shown
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It looks that what you're doing is not 'opening' the file (to work with it) in the servlet. Your servlet is just streaming the file to the client where it is opened.

If this is the case, this is not a servlet issue, it's an Excel issue and the question would be better asked in the Other APIs forum.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61430
    
  67

Moved to Other APIs.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: Error in excel sending additional request