Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JSP: How to check to see if file exists?

Reply
Thread Tools

JSP: How to check to see if file exists?

 
 
Sugapablo
Guest
Posts: n/a
 
      03-27-2006
What's the simplest way to see if a file exists on the server in JSP?

If possible, I'd like the the equivalent of:

<%
if(FunctionThatTellsMeFileExists("images/001.png")) {
out.println("YES");
}
else {
out.println("NO");
}
%>


--
Sugapablo
http://www.sugapablo.net

 
Reply With Quote
 
 
 
 
Carl
Guest
Posts: n/a
 
      03-27-2006
Sugapablo wrote:
> What's the simplest way to see if a file exists on the server in JSP?
>
> If possible, I'd like the the equivalent of:
>
> <%
> if(FunctionThatTellsMeFileExists("images/001.png")) {
> out.println("YES");
> }
> else {
> out.println("NO");
> }
> %>
>
>
> --
> Sugapablo
> http://www.sugapablo.net


You might want to try:
if ( new java.io.File("C:\test.txt").exists() ) ...

See also:
http://java.sun.com/j2se/1.5.0/docs/...a/io/File.html

Hope that helps,
Carl.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Desktop can see Laptop, but Laptop can't see Desktop! Plomaris Wireless Networking 3 02-17-2006 01:41 PM
Dell Inprion 1100 see's network with air card and regular network card but does not see the card help! Paul Tutle Sr. - OCC Computer Support 1 10-01-2004 09:23 PM
How to check to see if a file exist. Dave ASP .Net 3 05-18-2004 05:12 PM
Can you see why I'm getting a NoClassDefFoundError here? I can't see it :< Flip Java 3 02-09-2004 10:13 PM
INTERESTING PROBLEM -- CD doesn not see burned disks, but does see others md Computer Support 8 09-03-2003 09:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57