I’m starting to experiment with Spring MVC, and noticed that my jsps are served as html files. E.g.
<html>
<head>
...
</html>
How can I configure Spring MVC to serve xhtml files instead?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
...
</html>
Note – SpringMVC prefixes my jsp with the <html> tag, so I don’t have any room to add the doctype before that.
There is no quick fix to this one, basically you have to rewrite your jsps to be html compliant and add the appropriate DOCTYPE.
You can use JSPs to produce pretty much any type of text file. JSP itself doesn’t care if you are making a CSV, XHTML, Quirks mode HTML, or anything else.
Now if your using JSPX you are a little more limited in that those files have to be valid xml.