[opencms-dev] Re: Get file path for files with a specific value

Thomas Fabbricante tom_fabbricante at wunderman.com
Wed Mar 10 14:32:02 CET 2004


Hi Armen,
Thanks for the reply, but that approach is not working for me.

Tried...

CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);
CmsObject cmsObj = cms.getCmsObject();
Vector vecFiles = cmsObj.getFilesWithProperty("Office","testoffice");

StringBuffer stringOut = new StringBuffer("");
Enumeration e = vecFiles.elements();

while (e.hasMoreElements()) {
  CmsResource res = (CmsResource)e.nextElement();
  String fullpath = res.getAbsolutePath();
  stringOut.append(fullpath);
}
out.println(stringOut.toString());

Throws this error:

*****************************
javax.servlet.ServletException: Resource loader error in file
'/wunderman/test/property/searchprop2.jsp'

Root cause:
org.apache.jasper.JasperException
     at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
     at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
     at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:575)
                 ...
*****************************


-Thanks
-tom


                                                                                                  
                    "Armen Markarian"                                                             
                    <markarian at inexweb.       To:     <opencms-dev at opencms.org>                   
                    de>                       cc:                                                 
                    Sent by:                  Subject:     [opencms-dev] Re: Get file path for    
                    opencms-dev-admin at o        files ...                                          
                    pencms.org                                                                    
                                                                                                  
                                                                                                  
                    03/10/2004 04:27 AM                                                           
                    Please respond to                                                             
                    opencms-dev                                                                   
                                                                                                  
                                                                                                  




Hi tom, after you have filled the Vector vecFiles  use this code..

Enumeration e = vecFiles.elements();

while (e.hasMoreElements()) {
CmsResource res = (CmsResource)e.nextElement();
String fullpath = res.getAbsolutePath();

See further in API for CmsResource Object - it gives you very usefull
Methods

Regards

Armen






=============================================
This transmission is confidential and intended
solely for the person or organization to whom
it is addressed.  It may contain privileged and
confidential information.  If you are not the
intended recipient, you should not copy,
distribute or take any action in reliance on it.

If you have received this transmission in error,
please notify the sender at the e-mail address above.
==============================================




More information about the opencms-dev mailing list