[opencms-dev] inclusion loop when using recursive method ?

Nicolas Delsaux nicolas.delsaux at online.fr
Thu Jun 12 17:10:02 CEST 2003


Hi, I've written a recursive method for displaying my site hierarchy using 
<html list. But when I try to use this jsp fragment, lcoated in my elements 
folder, OpenCms returns an exception, explaining that there is an inclusion 
loop in my code. Can someone explain me why ?
Here is that jsp code.

<%@ page session="false" 
import="com.opencms.flex.jsp.*,com.opencms.file.*,java.util.*" %><%--
Linagora
--%>

<%!
public void listFilesAndFolders(com.opencms.flex.jsp.CmsJspActionElement 
cms, String uri) throws Exception {
ArrayList files = new ArrayList();
files.addAll(cms.getNavigation().getNavigationForFolder(uri);
if(files.size()) > 0) {
%>
<ul class="list-files">
%>
Iterator iter = files.iterator();
CmsJspNavElement nav;
String target;
while(iter.hasNext()) {
nav = (CmsJspNavElement) iter.next();
if(nav!=null) {
target = nav.getResourceName();
%><li class="list-files"><%
if(nav.isFolderLink()) {
target = cms.link(target + "index.jsp");
} else { // else if folderLink
target = cms.link(target);
} // end if folderLink
%>
<a class="list-files" href="<%= target%>"><%= nav.getNavText() %>
<%
if(nav.isFolderLink()) {
listFilesAndFolders(cms, nav.getResourceName());
}
} // end if nav!=null
} // end while
%></ul><%
} // end if size>0
} // end method
%>

<% com.opencms.flex.jsp.CmsJspActionElement cms = new 
com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response);

String uri = cms.getRequestContext().getUri();
try {
listFilesAndFolders(cms, uri);
} catch(Exception e) {
<%= e.getClass().getName() %>
<%= e.getMessage() %>
}
%>

-- 
Nicolas Delsaux
Bientôt, il y aura ici une signature



More information about the opencms-dev mailing list