how to use JFileChooser in a servlet and call this servlet from a jsp so that it allows to select the location where you want to save the file

0

I have this main that works correctly:

public static void main(String args[]) throws IOException, Exception {
        JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(new java.io.File("."));
        chooser.setDialogTitle("choosertitle");
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooser.setAcceptAllFileFilterUsed(false);
        if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
            String dirFolder = "" + chooser.getSelectedFile() + "";
            FunctionsOfZip zipFun = new FunctionsOfZip();
            zipFun.InputReader(dirFolder);
        } else {
            System.out.println("No Selection ");
        }
    }

What happens is that if I want to do this same code within a servlet I do not run, I'm new to this, I was looking for information, what I really want to do is that from a jsp with a link call to servlet and let me select the location where I want to save the file, there is an example that they use in jsp: input type="file" within form to upload file, but what I need is to download the file and give it a location, sorry if I have explained myself badly, I hope your advice and good vibes :) ayudaaaa

    
asked by Jose Luis Corrales Espinoza 05.11.2018 в 22:04
source

0 answers