I just created a java class that creates an excel document.
It has a function called saveToFile which saves the excel document to a file.
Now I also want to be able to "download" the document just created, I know I could create another class (a servlet) setting the content type to "application/vnd.ms-excel" and then download the file... But! I would like to do this in a single file (not create another file for the servlet), so I thought about creating a servlet subclass. But then I don't know how I can call the subclass from the other class. Any idea how I can achieve my goal (either by servlet subclass or anything else....) ??
Am I explaining my problem well enough?