How to delete files using jsp?

Thread Solved

Join Date: Sep 2008
Posts: 21
Reputation: dreamer14 is an unknown quantity at this point 
Solved Threads: 1
dreamer14 dreamer14 is offline Offline
Newbie Poster

How to delete files using jsp?

 
0
  #1
Dec 19th, 2008
I am just wondering if i want to delete a file using coding how can i do it using jsp?
Example i have a file name pig.jpg in my root folder and I wish to delete this file as i no longer use this any more how can i do this using coding?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,191
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 485
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: How to delete files using jsp?

 
0
  #2
Dec 19th, 2008
You should create some sort of view (in JSP) where user can browse the whole web folder structure something like this
Click image for larger version

Name:	folder_view.png
Views:	2
Size:	4.9 KB
ID:	8581
with some buttons on the bottom (I cut that off image would be to big)
Then let the user mark the file/folders for deleting. User hit the delete button, JSP send names of selected files for deletion together with current folder level to servlet, servlet does his deleting job and returns updated view in JSP of current folder level with some notifications message such as "file deleted", "unable to delete"
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 21
Reputation: dreamer14 is an unknown quantity at this point 
Solved Threads: 1
dreamer14 dreamer14 is offline Offline
Newbie Poster

Re: How to delete files using jsp?

 
0
  #3
Dec 19th, 2008
I know how to do most of it except the
"servlet does his deleting job".
Can i have a example for this?
Is it possible not to use a servlet but just coding ?
I am terribly bad at servlet.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,191
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 485
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: How to delete files using jsp?

 
0
  #4
Dec 19th, 2008
Servlets are essential in Java web development so you will not escape them if you considering job related to Java development. Sooner or later you will have to face your enemy and I would say do it now, because now you will learn easier then later to try put a side your previous bad habits.
If you can explain where you having difficulties with servlet implementation we may be able to help you.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 21
Reputation: dreamer14 is an unknown quantity at this point 
Solved Threads: 1
dreamer14 dreamer14 is offline Offline
Newbie Poster

Re: How to delete files using jsp?

 
0
  #5
Dec 19th, 2008
i hae only learn servlet for a few days so i have no idea where to start. Any reali basic guide to teach the baisc?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,191
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 485
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: How to delete files using jsp?

 
0
  #6
Dec 19th, 2008
General resource The Java EE 5 Tutorial, Beginning and Intermediate-Level Servlet, JSP, and JDBC Tutorials plus I enjoyed Java How to Program, 6th edition from Deitel
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 5
Reputation: rockonjava is an unknown quantity at this point 
Solved Threads: 1
rockonjava's Avatar
rockonjava rockonjava is offline Offline
Newbie Poster

Re: How to delete files using jsp?

 
0
  #7
Dec 29th, 2008
Deleting file JSP code

<%
File f=new File("c:\\imagesFolder\\pig.jpg");

f.delete();

%>

In linux machine you have to use different separator

Search platform Independent separator for operating system
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,191
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 485
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: How to delete files using jsp?

 
0
  #8
Dec 29th, 2008
Originally Posted by rockonjava View Post
Deleting file JSP code

<%
File f=new File("c:\\imagesFolder\\pig.jpg");

f.delete();

%>

In linux machine you have to use different separator

Search platform Independent separator for operating system
I'm trying to show dreamer14 how to do things the correct way and you just drop in some scriplet solution? Also you made few other post where you even suggested to do DB connectivity from JSP, I do not think they will be overly popular.
Not that I did not use scriplets before too, but since then I made some progress in this field
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JSP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC