The moose likes JSP and the fly likes Doing ftp from a JSP 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 » JSP
Bookmark "Doing ftp from a JSP" Watch "Doing ftp from a JSP" New topic

Doing ftp from a JSP

Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Hi all,
From my jsp page I want to do an FTP to a mainframe system.
How can I do an ftp from JSP.
I have to ftp to a mainframe system in the same network. i do have the IP, username and password.
Tony Alicea

Joined: Jan 30, 2000
Posts: 3222
I would use the java.net.URL and java.net.URLConncetion classes:
public URL(String protocol,
String host,
int port,
String file)
throws MalformedURLException

protected URLConnection(URL url)
Constructs a URL connection to the specified URL. A connection to the object referenced by the
URL is not created.
url - the specified URL.

It gets involved and it's not trivial...

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
An alternative is to use a free or commercial FTP JavaBeans. There is one here:
and another here:
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Hi Kyle,
Thanks for this.
I am trying to use them now
well, do u have a sample code that u can give me
jQuery in Action, 2nd edition
subject: Doing ftp from a JSP
Similar Threads
FTP v/s HTTP, which one is better?
How do I FTP files form my html form using "input type=file" through jsp/servlet
Java network client application, is it possible??
Please suggest ways to tackle this