Custom JSP tag Directory lets you display and proceed content for any directory on your server. Tag executes own body for each file in the specified directory. Within tag's body you may use predefined page scope variables for access to attributes of current file (name, size, last modification date). Tag lastFile lets you select a file with the most fresh modification date. For example:
<%@ taglib uri="taglib.tld" prefix="get" %> Root directory <get:Directory path="/" > File: <%=fileName%> Size: <%=fileSize%> bytes Modified: <%=fileDate%> </get:Directory> in this example tag prints all files for root directory You can provide a pattern for file names also. E.g.:
<%@ taglib uri="taglib.tld" prefix="get" %> <!-- specified files only --> <get:Directory path="/" pattern="A*.doc"> ... </get:Directory> You can restrict file area and proceed files with the specified extension (extensions) only.
E.g. let we display .zip and .jar files only:
<%@ taglib uri="taglib.tld" prefix="get" %> Archives in root directory <get:Directory path="/" ext="zip,jar"> ... </get:Directory> Latest updated zip file is <lastFile path="/" pattern="*.zip"> Tags are: Directory Body tag. Executes own body for each file in the given directory. Parameters are: 1) path source path
lastFile Lets you obtain a name for the last modified file in the given directory. Parameters are: 1) path source path
randomFile Lets you obtain a name for the random file in the given directory. Parameters are: 1) path source path
for downloading: Library: dirtag.jar Description: taglib.tld See also Coldtags suite - the largest collection of custom JSP tags.
|
Also in Coldtags suite:
|