I have developed a small JSP template which displays a list of files in the current directory (Directory Navigation).

The filename is displaying in the template only when I change it's navigation position explicitly. More over Iam unable to display pdf's and Image files(which is important for me)

Eventhough I logged in as "Admin" with password "admin", sometimes Iam facing an error while changing the Nav-Pos.

Below Iam Pasting the Source-code and Error.

Hopefully waiting for any solution..

Thanks in advance,
It's Raza Naqvi...

************
Source Code
************
<%@ page import="com.opencms.core.*,java.util.*,com.opencms.flex.jsp.*" %>
<%    
    //test
    // Create a JSP action element
    com.opencms.flex.jsp.CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);
    
    // Get the current file and folder name
    String filename = cms.getCmsObject().getRequestContext().getUri();
    String foldername = com.opencms.file.CmsFile.getPath(filename);    
      
    boolean examplefolder = "true".equals(cms.property("examplefolder", "search", "false"));    
        
    
        
    // Get a list of all pages / subfolders in the folder (sorted by NavPos property)
    ArrayList list = cms.getNavigation().getNavigationForFolder();
    
    Iterator i = list.iterator();

    while (i.hasNext()) 
    {
        CmsJspNavElement ne = (CmsJspNavElement)i.next();
        String description = ne.getDescription();

    	String target = ne.getProperty("target");
        if (! "external".equals(target)) 
            target = "_self";
        if (! ne.getResourceName().equals(filename)) 
        {  
            out.println("<p><b><a href=\"" + cms.link(ne.getResourceName()) + "\" target=\"" + target + "\" >");                           
            out.println(ne.getTitle() + "</a></b>");
            
        }
        out.println("</p>");
    }
  
  %>


************
Error
************
com.opencms.core.CmsException: 2 Not found. Detailed error: [com.opencms.file.mySql.CmsDbAccess] NavPos. 
	at com.opencms.file.genericSql.CmsDbAccess.writeProperty(CmsDbAccess.java:11766)
	at com.opencms.file.mySql.CmsDbAccess.writeProperty(CmsDbAccess.java:969)
	at com.opencms.file.genericSql.CmsResourceBroker.writeProperty(CmsResourceBroker.java:7724)
	at com.opencms.file.CmsObject.writeProperty(CmsObject.java:3914)
	at com.opencms.workplace.CmsChnav.updateNavPos(CmsChnav.java:412)
	at com.opencms.workplace.CmsChnav.getContent(CmsChnav.java:111)
	at com.opencms.template.cache.CmsElementXml.getContent(CmsElementXml.java:171)
	at com.opencms.template.cache.CmsUri.callCanonicalRoot(CmsUri.java:185)
	at com.opencms.template.cache.CmsElementCache.callCanonicalRoot(CmsElementCache.java:149)
	at com.opencms.launcher.CmsXmlLauncher.generateOutput(CmsXmlLauncher.java:285)
	at com.opencms.launcher.CmsXmlLauncher.launch(CmsXmlLauncher.java:341)
	at com.opencms.launcher.A_CmsLauncher.initlaunch(A_CmsLauncher.java:274)
	at com.opencms.core.OpenCms.showResource(OpenCms.java:956)
	at com.opencms.core.OpenCmsHttpServlet.doGet(OpenCmsHttpServlet.java:310)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1005)
	at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098)
	at java.lang.Thread.run(Thread.java:536)

_____________________________________________________________
I use Krify Mail - http://mail.krify.com  Get  Yourname at  Krify today!

