[OT] Re: Fwd: export file data using formFile

2008-12-17 Thread Dave Newton
--- On Wed, 12/17/08, elyes sallem wrote: > String mimetype = context.getMimeType(filePath.replaceAll("/", "//")); You shouldn't need to do that. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional

Re: Fwd: export file data using formFile

2008-12-17 Thread elyes sallem
be coool ..., in fact i didn't that before download or upload it is new dev , that is why ...(all we begin by this step, it was the case for you i suppose...), furtheremore, i resolved it => (so don't think that i'm waiting response ...) those who are interested , here is the code i added at the b

Re: Fwd: export file data using formFile

2008-12-17 Thread Robert Graf-Waczenski
elyes sallem wrote: it forwarded me to page with "unreadable data" comapred to the first example, you omit the resp.setHeader("Content-Disposition", ... Sorry if this sounds a bit harsh, but the people on this list are not here to solve any single Java or Servlet-API related mystery for you

Re: Fwd: export file data using formFile

2008-12-16 Thread elyes sallem
it forwarded me to page with "unreadable data" comapred to the first example, you omit the resp.setHeader("Content-Disposition", ... here is the code ,i have the export method in a dispatch action : public ActionForward exportSelectedIntaff(ActionMapping mapping, ActionForm form, H

Re: Fwd: export file data using formFile

2008-12-16 Thread Robert Graf-Waczenski
Hi Elyes, something like this here should work: OutputStream out = resp.getOutputStream(); FileInputStream fileStream = new FileInputStream("path/to/your/excelFile.xls"); int bufferLen = 1024 * 8;// 8 KB byte[] buffer = new byte[bufferLen]; while (tru

Re: Fwd: export file data using formFile

2008-12-16 Thread elyes sallem
Hello Robert , so assume that i have an excel file on the server and i have a button to download it for the client (of course with a browse dialog) could you show me how develop it , in your example , you call writePDFDataToOutputStream and it is a pdf file which is not my case Thanks Regards Ely

Re: Fwd: export file data using formFile

2008-12-15 Thread Oscar Alvarez
I think, you need to put a hiperlink or a button for start your action. Then you need to retrieve the data from the db, generate the csv Stream or File as you wish to call it. Then the only diference between a Servlet.doGet method an Action.execute method is 2 parameters ActionMapping and ActionFor

Re: Fwd: export file data using formFile

2008-12-15 Thread Dave Newton
--- On Mon, 12/15/08, elyes sallem wrote: > do you have an other solution? the html:file doesn't > work for saving a new file Stream the result (a servlet example was given, it's the same for an action-you just return null instead of an ActionForward). The *BROWSER* opens a "save as" dialog box.

Re: Fwd: export file data using formFile

2008-12-15 Thread elyes sallem
2008/12/15 Dave Newton > *boggled* > > --- On Mon, 12/15/08, elyes sallem wrote: > > i used a filechooser class (swing), if any one have an > > others solution, i'm interested here is the code : > > > > String wd = System.getProperty("user.dir"); > > JFileChooser fc = new JFileChooser(wd); > >

Re: Fwd: export file data using formFile

2008-12-15 Thread Dave Newton
*boggled* --- On Mon, 12/15/08, elyes sallem wrote: > i used a filechooser class (swing), if any one have an > others solution, i'm interested here is the code : > > String wd = System.getProperty("user.dir"); > JFileChooser fc = new JFileChooser(wd); > int rc = fc.showDialog(null, "Select Data

Re: Fwd: export file data using formFile

2008-12-15 Thread elyes sallem
i used a filechooser class (swing), if any one have an others solution, i'm interested here is the code : String wd = System.getProperty("user.dir"); JFileChooser fc = new JFileChooser(wd); int rc = fc.showDialog(null, "Select Data File"); if (rc == JFileChooser.APPROVE_OPTION) { File file = fc.g

Re: Fwd: export file data using formFile

2008-12-15 Thread elyes sallem
in fact, i will not do it in a servlet, but in an action (execute method) Regards Elyes 2008/12/15 Robert Graf-Waczenski > Here's an example: > > public class Downloader extends HttpServlet > { > private void doGet(HttpServletRequest req, HttpServletResponse resp) throws > IOException > { >

Re: Fwd: export file data using formFile

2008-12-15 Thread Robert Graf-Waczenski
Here's an example: public class Downloader extends HttpServlet { private void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setHeader("Pragma", "no-cache"); resp.setHeader("Cache-control", "no-cache"); resp.setIntHeader("Expires", -1);

Re: Fwd: export file data using formFile

2008-12-15 Thread elyes sallem
the data will be generated dynamically , depending on others selected fields and based on a select to a database table, i will generate a csv file 2008/12/15 Robert Graf-Waczenski > Hm. Sounds more like a download, not like an upload. Is that what you're > after? > > Robert > > > elyes sallem

Re: Fwd: export file data using formFile

2008-12-15 Thread elyes sallem
ok, do you have an example? Thanks Regards Elyes 2008/12/15 Dave Newton > --- On Mon, 12/15/08, elyes sallem wrote: > > the problem is that with the html:file you must browse to an > > existant file, but in my case, i wanna browse to a new file, > > and then in the action i will make some trea

Re: Fwd: export file data using formFile

2008-12-15 Thread Robert Graf-Waczenski
Hm. Sounds more like a download, not like an upload. Is that what you're after? Robert elyes sallem wrote: the problem is that with the html:file you must browse to an existant file, but in my case, i wanna browse to a new file, and then in the action i will make some treatment, generate data

Re: Fwd: export file data using formFile

2008-12-15 Thread Nils-Helge Garli Hegvik
That's what the "Save As" dialog is for. Nils-H On Mon, Dec 15, 2008 at 3:03 PM, elyes sallem wrote: > the problem is that with the html:file you must browse to an existant file, > but in my case, i wanna browse to a new file, and then in the action > i will make some treatment, generate data an

Re: Fwd: export file data using formFile

2008-12-15 Thread Dave Newton
--- On Mon, 12/15/08, elyes sallem wrote: > the problem is that with the html:file you must browse to an > existant file, but in my case, i wanna browse to a new file, > and then in the action i will make some treatment, generate > data and export them to this file That's not how you do that. Y

Re: Fwd: export file data using formFile

2008-12-15 Thread elyes sallem
the problem is that with the html:file you must browse to an existant file, but in my case, i wanna browse to a new file, and then in the action i will make some treatment, generate data and export them to this file 2008/12/15 Dave Newton > --- On Mon, 12/15/08, elyes sallem wrote: > > it is no

Re: Fwd: export file data using formFile

2008-12-15 Thread Dave Newton
--- On Mon, 12/15/08, elyes sallem wrote: > it is not to export the file content , i want juste get back in the > action, the *selected file path* Oh, I thought you said "[...] struts tag to export file [...]" >> --- On Mon, 12/15/08, elyes sallem wrote: >>> all i want, is what is the struts tag

Re: Fwd: export file data using formFile

2008-12-15 Thread Robert Graf-Waczenski
There is no reliable way to get the selected file path. This has been discussed a few days ago on this list. Robert elyes sallem wrote: it is not to export the file content , i want juste get back in the action, the *selected file path* 2008/12/15 Dave Newton --- On Mon, 12/15/08, elyes

Re: Fwd: export file data using formFile

2008-12-15 Thread elyes sallem
it is not to export the file content , i want juste get back in the action, the *selected file path* 2008/12/15 Dave Newton > --- On Mon, 12/15/08, elyes sallem wrote: > > all i want, is what is the struts tag to export file [...] > > There is no tag to export a file. > > Dave > > >

Re: Fwd: export file data using formFile

2008-12-15 Thread Dave Newton
--- On Mon, 12/15/08, elyes sallem wrote: > all i want, is what is the struts tag to export file [...] There is no tag to export a file. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands,

Fwd: export file data using formFile

2008-12-15 Thread elyes sallem
Regards Elyes -- Forwarded message -- From: elyes sallem Date: 2008/12/15 Subject: export file data using formFile To: Struts Users Mailing List Hello, i want to use a formfile in jsp page, where once i browse to file , i want to laucnh directly the action, export data to this file (without

export file data using formFile

2008-12-15 Thread elyes sallem
Hello, i want to use a formfile in jsp page, where once i browse to file , i want to laucnh directly the action, export data to this file (without a submit button near the fromfile) how can i make it? Regards Elyes.