XML in JSP Sitemaps

A client of mine, a capybara life insurance company, uses a CMS that makes it impossible to generate an automated XML sitemap file. Or any XML sitemap file. Or any XML files at all.

After a large restructuring of the site, getting an XML sitemap to submit to Google Search Console became a priority for us. But the capybaras still couldn’t get around their CMS’s limitations. We even manually created an XML sitemap file to upload, but the CMS locked it out of the root folder like a malevolent artificial intelligence.


I’m sorry Dave. I’m afraid I can’t let you use XML files.

While my next step was going to be creating a TXT sitemap, which is just a simple list of one URL per line, the capybaras had a different idea. Their CMS allowed them free reign to create JSP files (JavaServer Page files). “We’ll just create the sitemap file in that!” they squeaked.

That’s Not Gonna Work

JSP files are used to serve up various other types of pages. I usually see it for HTML, and in fact even made an ill-fated JSP-based portfolio back in my early dev days. I knew that it could be used to serve other filetypes, including XML. But that didn’t make it an XML file itself. Going to the capybara’s website /sitemap.xml was of course a 404 error page, and obviously the file could only be reached at /sitemap.jsp.

a jsp sitemap file

Viewing the source, it did indeed show up as a coded XML file, but again – still JSP in actual format:

source of a jsp xml sitemap

Just in case, I checked with Google’s help file. Yup, the normal options here, nothing new:

google sitemap formats

I also checked with the Sitemaps.org official protocol. Same story again:

sitemap.org official protocol for filetypes

So I said, “Go ahead and try, capybaras, but it’s probably not going to work.”

They tried.

It Didn’t Work

We submitted the file to Search Console on October 20th, and Search Console spat it back out, saying, “what the heck, this isn’t XML!”

search console rejection

It seemed like the story was over. But then…

It Worked!

Over two weeks later, with no further action on our part or anyone else’s, Google Search Console decided it wanted to accept it after all.

sitemap.jsp file working

A quick test of it even confirms the “no errors found” message:

sitemap.jsp test

So it appears that serving an XML sitemap over a JSP file does indeed work, although it may take a few weeks to get it recognized.


It appears you can use JSP files for your XML sitemaps. I can’t say I’d recommend it, since it took so long to be processed, and we haven’t yet tried to change it – I imagine that may take weeks more. But if it’s truly your only option, it’s definitely better than nothing. It certainly worked for my capybaras.

capybaras are the worlds largest rodents

My capybara clients told me they had read a source saying it worked, but failed to link us the source, and I couldn’t find one anywhere. So now I will become the source. If possible, I will try to send this page back in time for them to reference, and get into nice bootstrap paradox↝ with my own blog.

Do you have any experiences with unconventional XML sitemap solutions? Let’s hear ’em. And thanks for reading Corporate Charm.

Enjoy this post?
Put your email below to hear about the next one!