Make your JSP an XHTML
<?xml version="1.0" encoding="utf-8"?> <% response.setContentType("application/xhtml+xml"); %>
Note that the XML declaration has to be in the first line for a valid XHTML. Of course, after doing this, you need to make all your tags valid XML in your JSP as well.