Wednesday, 18 May 2011

JSTL not working? Check that you have the correct servlet version in web.xml!!!

This is a pretty silly gotcha, but this normally wouldn't have
happened since most of the time I'm working on updates to existing
deployed webapps running on Tomcat 6.

Anyway, this sucked up about 1 hour of my life, trying to find out why
my JSP 2.0 style tags weren't working. Even things as basic as c:out
weren't working either.

Finally stumbled upon a forum post that pointed to this.

Aha!! The webapp I'd created using the Maven archetype
maven-archetype-webapp has Servlet 2.3 declared in it's web.xml. A
version that is pretty bloody old, considering the ref implementation
for that is Tomcat 4! Seriously, an upgrade for the built-in web.xml
wouldn't be that hard to do, Maven plugin people!

Anyway, all's well.

For now.