I have a web application build on Tomcat and J2EE application server. (JSP/Servlet <---> EJBs <---> Database)
- Posted by: Wallace Zou
- Posted on: January 07 2003 17:20 EST
In my web business, the application will generate a txt file and present it to the user. I prepare to provide three ways to aproach this:
1- Send a mail attaching the file;
2- Display the file content as upon the request;
3- Give a hyper link in web page, allow the user download it immediatly.
The 1 and 2 are easy to implement, but how to do 3? Should J2EE write a physical file or Servlet? How to manage the files while hundred people send the request to apply their own files?
Could u help me?
Thanks a lot!
- How to present file to user in Web based J2EE application by Dave C on January 08 2003 12:40 EST
- How to present file to user in Web based J2EE application by Wallace Zou on January 08 2003 15:01 EST
- How to present file to user in Web based J2EE application by Wallace Zou on January 11 2003 14:07 EST
- How to present file to user in Web based J2EE application by anecss anecss on February 21 2003 04:19 EST
- How to present file to user in Web based J2EE application by Raj Pat on January 09 2003 00:19 EST
- How to present file to user in Web based J2EE application by Marina Prikaschikova on January 09 2003 00:32 EST
The URL could just be a servlet URL where it sends the file, but sets the mimetype to something like application/octet-stream which would force the user to download the content.
Interesting, it's a good idea,
Hi, I find the right place here!
Thanks for your replies!
From help of Dave C, I write a servlet to let user download a text file which is generated dynamically:
PrintWriter pw = response.getWriter();
It's simple and working. But now if it can prompt a file name to user when it starts that will be perfect, anyone can help!
Just provide link to the related file.If its a text file(or even word document) it will display in the browser itself.If it encounters some different format it will ask the user to download.
See for example Content tag from Coldtags suite:
you may include files that are located outside of your web application