jeudi 2 juillet 2015

how to write new folder inside WebContent from Servlet

I am trying to create a new folder inside WebContent/images from my Servlet code drafted below

    String appPath = request.getServletContext().getContextPath();
    String savePath = appPath +"WebContent/images";

    File file=new File(savePath);
    if(!file.exists()){
      file.mkdirs();
    } 

Please suggest a way to accomplish this

Aucun commentaire:

Enregistrer un commentaire