<%@ page import="java.util.ArrayList" %> <%@ page import="java.util.StringTokenizer" %> <% // check HTTP request for userName and password // for request from the Login page String userName = request.getParameter("userName"); String password = request.getParameter("password"); if (userName==null || password==null) { // either userName or password is not found, // the request is not from the Login page, // check cookies userName = DBBeanId.getCookie(request, "userName"); password = DBBeanId.getCookie(request, "password"); } if (userName==null || password==null) { // userName and password still not found // this must be an illegal attempt to bypass // the Login page response.sendRedirect("Login.html"); } // now userName and password are found, // verify if it is an authorized user if (!DBBeanId.verifyUser(userName, password)) response.sendRedirect("Login.html"); else { //authorized user, create cookies here Cookie cookieUserName = new Cookie("userName", userName); Cookie cookiePassword = new Cookie("password", password); response.addCookie(cookieUserName); response.addCookie(cookiePassword); } %> DisplayObjects <% // string containing javascript script // built on the fly. String js=""; // ------------------------------------- String parentId = null; // the current folder id String id = request.getParameter("id"); boolean atRoot = false; if (id==null) id = "1"; // 1 is the root if (id.equals("1")) atRoot = true; if (!atRoot) { // display the link to go up one level. // this link calls this same page, // passing the parent id parentId = DBBeanId.getParentId(id, userName, password); out.println("" + "
"); } String currentFolderName = DBBeanId.getFolderName(id, userName, password); if (currentFolderName==null) out.println("You don't have permission to" + " view this folder."); else { out.println("Current Folder: " + currentFolderName + ""); %> <% ArrayList records = DBBeanId.getChildObjects( id, userName, password); for (int i=0; i"; objectLink = ""; objectType = "Folder"; // ---- this is for part 2 ----------------- //create javascript string for subfolders js+="parent.appendFolder(parent.folderTree," + id + ",parent.createFolder(" + objectId + ",'" + name + "'));\n"; // ----------------------------------------- } else { //file imagePath = ""; objectLink = ""; objectType = "File"; } out.println("\n"); out.println(" \n"); out.println(" \n"); out.println("\n"); } %>
Name Type
" + objectLink + imagePath + " " + objectLink + name + "" + objectType + "

Upload File:
<% } %>