[opencms-dev] OpenCMS / Google Sitemap generation script

Arash Kaffamanesh arash.kaffamanesh at pomegranate.de
Fri Oct 7 01:02:59 CEST 2005

 Hi Tim,
I'm getting this error on OpenCms 6 Beta 3 (I guess it works on 6.0
final, I'll try it on 6.0 after upgrading from Beta3 and let you know
how it works, thanks for the contribution):
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 7 in the jsp file:
Generated servlet error:
The method readPropertyObject(String, String, boolean) in the type
CmsObject is not applicable for the arguments (CmsFile, String, boolean)
Kind Regards,

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Tim Howland
Sent: Donnerstag, 6. Oktober 2005 18:40
To: opencms-dev at opencms.org
Subject: [opencms-dev] OpenCMS / Google Sitemap generation script

Hey folks-

I wrote the following jsp page to generate XML sitemaps that Google can
read (see http://www.google.com/webmasters/sitemaps/docs/en/faq.html ).

Basically, it recurses through your site tree and pulls out any jsp,
html, or pdf files it finds, generating a link in Google's format so
they can locate the file.

It also looks for three custom properties- these properties can be set
at the folder level, they will cascade to all files and subfolders

*	sitemap_hidden (default value: false): set this to "true" to
hide something from this script. I use it to hide client extranets and
include files. 

*	sitemap_change_frequency (default value: weekly): controls how
often google should check for an update of this element. Legal values
are:   always,  hourly, daily, weekly, monthly, yearly, never . 

*	sitemap_priority (default value: 1): the relative priority of
this element. Should be an integer. 

Here's the script- improvements and comments are welcome, of course:

<%@ page session="false" %>

<%@ page
ormat, java.text.SimpleDateFormat, org.opencms.main.*" %>

<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms"
<http://www.opencms.org/taglib/cms>  %>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"
<http://java.sun.com/jstl/core>  %>

<?xml version="1.0" encoding="UTF-8" ?>

<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
<http://www.google.com/schemas/sitemap/0.84> >


protected String BASE_URL="";

public static SimpleDateFormat ISO8601FORMAT = new

private String recurseTree(CmsObject cmso,CmsJspActionElement jsp,
String path)  {

	StringBuffer sb = new StringBuffer();

	try {

		ArrayList files = (ArrayList)

		Iterator i = files.iterator();

		while (i.hasNext()) {

			CmsFile f = (CmsFile) i.next();	

			String thispath = jsp.link(cmso.getSitePath(f));

			CmsProperty secret =

			CmsProperty changeFreqProperty =

			CmsProperty priorityProperty =

			String changeFrequency =

			String priority =

			if ((secret.getValue("false") == "false") 

"pdf"))) {		



				//DateFormat df =

				String niceDate =
ISO8601FORMAT.format(new Date(f.getDateLastModified()));







		ArrayList folders = (ArrayList)

		Iterator j = folders.iterator();	

		while (j.hasNext()) {

			CmsFolder f = (CmsFolder) j.next();

			sb.append( recurseTree(cmso,jsp,
cmso.getSitePath(f) ) );



	catch (CmsException cmsException) {

		sb.append("A CMS exception occurred:



	return sb.toString();




CmsJspActionElement cms = new
org.opencms.jsp.CmsJspActionElement(pageContext, request, response);

CmsObject cmso = cms.getCmsObject();

String url = cms.info("opencms.url");

int lastSlash = url.indexOf("/",8);

BASE_URL = url.substring(0,lastSlash);

out.println (recurseTree(cmso,cms, "/"));


You can download it (plus a readme file with slightly more info) from
http://www.wdogsystems.com/opencms/opencms/downloads/index.jsp .


 Tim Howland

 Watchdog Systems, LLC

 (978) 225-8494


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20051007/755bbc08/attachment.html>

More information about the opencms-dev mailing list