I'm a seasoned .net guy - new to Java. I'm Trying to do the simplest of things but can't figure it out. In my web form I want to create a csv file (from a json string) and present it to the user to download (I do not want to specify a directory - let the user do that)
I have this working code which writes my file to a directory but really all I want is for it to download in the browser - NOT write to a filepath. How is this done?
I have this working code which writes my file to a directory but really all I want is for it to download in the browser - NOT write to a filepath. How is this done?
Code:
JSONObject output = new JSONObject(jsonString); JSONArray docs = output.getJSONArray("myData"); File file=new File("C:\\Work\\fromJSON.csv"); //DON'T WANT TO SPECIFY A DIRECTORY String csv = CDL.toString(docs); FileUtils.writeStringToFile(file, csv);
Comment