[opencms-dev] directory listing

Wagner,Aaron anwagner at deq.virginia.gov
Thu Apr 3 18:04:05 CEST 2008


 

I have a directory listing script like this, but now I need to expand it
to show all kinds of files, IE binary(pdf, doc, etc).  It appears that
the getNavigationForFolder(); only shows xmlpage file types.

 

I don't have access to change the directory listing settings in web.xml
of the Tomcat server.  Does anyone have any ideas to show all files in a
directory?

 

------------------------------

<%@ page import="java.util.*,

                 org.opencms.jsp.*" %><%     

 

// Create a JSP action element

CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);

 

// Get a simple navigation of all pages / subfolders in the current
folder 

String uri = cms.getRequestContext().getUri();

String uri2 = uri.substring(0, uri.lastIndexOf("/"));

 

List list = cms.getNavigation().getNavigationForFolder();

Iterator i = list.iterator();

int navnumb = list.size();

 

out.println("<h3>Directory listing for " + uri2 + " | Number of files: "
+ navnumb +"</h3><ul>");

while (i.hasNext()) {

  CmsJspNavElement ne = (CmsJspNavElement)i.next();

  out.println("<li><a href=\"" + cms.link(ne.getFileName()) + "\">");

  out.println(ne.getTitle() + "</a></li>");

}    

out.println("</ul>");

%>

------------------------------

 

Opencms 6,2,3

Tomcat 5

Ocacle 10

 

 

Aaron N Wagner

Web Developer, Office of Public Affairs

DEQ - Virginia Department of Environmental Quality

[W] 804.698.4265

 

There are 10 types of people in the world: those who understand binary,
and those who don't. 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080403/a612717f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wagner,Aaron.vcf
Type: text/x-vcard
Size: 367 bytes
Desc: Wagner,Aaron.vcf
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080403/a612717f/attachment.vcf>


More information about the opencms-dev mailing list