File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Downloading a file from the server. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Downloading a file from the server." Watch "Downloading a file from the server." New topic

Downloading a file from the server.

janet ilieva

Joined: Feb 02, 2001
Posts: 11
I am having trouble with downloading a file from the server.
the programme works like this:
1. send request from a form to a controller
2. controller runs a RequestHandler - Java code that gets session beans
and creates the file,
3. I then set the content type and output the file
now the problem is that when I return to the controller, it tries to
forward to a new page. this it cannot do because I have sent output.
I have tried to use the form to open a window with javascript and download
the file like that but its too quick, the file has not jet been generated.
If anyone has any comments to help me or a solotion please respond.
Suneel Setlur
Ranch Hand

Joined: Nov 26, 2000
Posts: 202
Hi Janet,
Are you using a session bean to create a file and write content?
EJBs cannot use io operations to read or write and hence cannot create a file.

subject: Downloading a file from the server.
It's not a secret anymore!