Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 4. Net > FTP Implementation

FTP Implementation

The code for the user interface is shown in Listing 4-1. You’ll notice that the FTPConnection class does the bulk of the work, including much of the formatting of the returned listings.

Listing 4-1. FTP Web JSP User Interface

<%@ page contentType="text/html; charset=iso-8859-1"
language="java" import="com.cascadetg.ch04.*"  %><%
String directory = request.getParameter("dir");
FTPConnection myConnection = new FTPConnection();
if(directory != null)
    myConnection.setWorkingDirectory(directory);

myConnection.connect();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FTP Listing : /<%= myConnection.getWorkingDirectory() %></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
.filelist {
    width: 100%;
}
-->
</style>
<link href="../ch03/default.css" rel="stylesheet" type="text/css" />
</head>

<body>
<p><strong>Directory : <%=
myConnection.getHTMLFormattedWorkingDirectory("ftp.jsp")
%></strong></p>
<hr />
<p><%=myConnection.getHTMLFormattedList("ftp.jsp") %>
</p>
<p><a href="ftp.jsp">Return to default directory</a> </p>
</body>
</html>


					  


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial