• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deleting a page

 
Jonathan Chiu
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I delete a html page / file within my filestore while using servlets?
 
Phil Hanna
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet is no different in this respect than any other Java class. You can use the delete() method in the java.io.File class:
File myFile = new File("c:/whatever/somefile");
myFile.delete();
------------------
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic