This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Deleting a page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Deleting a page" Watch "Deleting a page" New topic
Author

Deleting a page

Jonathan Chiu
Greenhorn

Joined: Aug 01, 2001
Posts: 9
How can I delete a html page / file within my filestore while using servlets?
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
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


Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deleting a page
 
Similar Threads
serialization and deserialization support in SOAP
isThreadSafe
stay with same page after submiting form
Main
EntityManager in Servlets Doubt