Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
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.
|
Code View:
Scroll
/
Show All
<%@ 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>
|