Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in excel sending additional request

 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to Other APIs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic