javascript - Write data into JS file and download it in ZIP file format -


in jsp, have button named "download zip file". when click button, want fetch data database , write js file , keep inside folder , download folder in zip format. using struts2.

how can this?

one way serve binary data servlet. this:

byte[] zipfilebytes = ...;// generate zip file , bytes response.setcontenttype("application/octet-stream"); response.getoutputstream().write(zipfilebytes ); 

then use standard anchor element download file:

<a src="url servlet">download file</a> 

you might need play little bit match exact use case.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -