[opencms-dev] extracting Property attributes from within a JSP

Rod Thorburn rod.thorburn at pavtech.co.nz
Wed Sep 18 01:53:50 CEST 2002


I am exploring the jsp functionality in opencms5_beta to build a dynamic directory listing (based on the flex-examples that came with the distribution). The following code snippet returns the Description, Title and NavText elements for each .html file in the directory /news/articles/

  // Link substitutor to make sure static export works 
  com.opencms.util.LinkSubstitution subst = new com.opencms.util.LinkSubstitution();
  // Collect the objects required to access the OpenCms VFS from the request
  com.opencms.flex.cache.CmsFlexRequest req = (com.opencms.flex.cache.CmsFlexRequest)request;
  com.opencms.file.CmsObject cms = req.getCmsObject();
  com.opencms.file.CmsFile file = req.getCmsFile();

  // Get the folder name
  String foldername = "/news/articles/";

  // Get a list of all pages / subfolders in the folder (sorted by NavPos property)
  java.util.ArrayList list = CmsJspNavElement.getNavigationForFolder(cms, foldername); 
  java.util.Iterator i = list.iterator();
  while (i.hasNext()) 
  {
      CmsJspNavElement ne = (CmsJspNavElement)i.next();
      %><p>
          <%=ne.getDescription() != null ? ne.getDescription() : "" %><br>
          <%=ne.getTitle() != null ? ne.getTitle() : "" %><br>
          <a href="<%=subst.getLinkSubstitution(cms, ne.getResourceName())%>"><%=ne.getNavText() != null ? ne.getNavText() : "" %                ></a>
      </p><%
  }


What I also want to do is extract or use other Property values for a given .html file, that are not defined by CmsJspNavElement.java . For example , I may have created a Property called "Date", or I might want to select only certain .html files by a value in the "Key Words" Property.

The temtation is to call the method getProperty() , but this method is not defined in the CmsJspNavElement class (as far as I can determine it is only available in CmsJspTagUser.java) .

Does anyone know of a way of accessing additional file Properties in the above context without writing additional code in the appropriate classes?

Rod

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20020918/15c971d9/attachment.htm>


More information about the opencms-dev mailing list