1 16 17 package org.apache.taglibs.gnat; 18 19 import org.apache.taglibs.gnat.util.*; 20 import javax.servlet.jsp.*; 21 import javax.servlet.jsp.tagext.*; 22 import java.io.*; 23 import java.util.*; 24 25 public class deltreeTag extends TagSupport 26 { 27 private String dir = ""; 28 private File _f; 29 private ResourceBundle gnatRB = ListResourceBundle.getBundle("org.apache.taglibs.gnat.util.GnatTagStrings"); 30 private ResourceBundle gnatERB = ListResourceBundle.getBundle("org.apache.taglibs.gnat.util.GnatExceptionStrings"); 31 32 public void setDir(String dir) 33 { 34 this.dir = dir; 35 } 36 37 40 public int doEndTag() throws JspException 41 { 42 if (!dir.equals("")) 43 { 44 _f = FileUtil.resolveFile(null,dir); 45 46 try 47 { 48 FileUtil.forceDelete(_f); 49 } 50 catch(IOException ioe) 51 { 52 throw new JspTagException(gnatRB.getString("deltree.tag") +": "+ ioe.getMessage()); 53 } 54 } 55 else 56 { 57 throw new JspTagException(gnatRB.getString("deltree.tag") +": "+ gnatERB.getString("empty.dir.attribute")); 58 } 59 return EVAL_PAGE; 60 } 61 62 65 public String getDir() 66 { 67 return dir; 68 } 69 } 70 | Popular Tags |