
Originally Posted by
jonmor
Aha, I think I may have been misunderstanding what the term 'view' meant in this context. It's not the View class, but the jsp (for example). If I stick the following at the top of my JSP, it works:
<%@ page contentType="text/xml; charset=UTF-8" %>
We just got this to work with the InternalResourceViewResolver with the following trick.
First, our InternalResourceViewResolver is configured in the standard way:
Code:
<bean name="tempViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="order" value="2" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
Then, our JSP has the following on the very first line:
Code:
<%@ page contentType="text/xml; charset=UTF-8" %><?xml version="1.0" encoding="UTF-8"?>
<xmlElements...>
It is important to note that the <xml ..> tag is on the same line as the page directive. With the <xml ...> tag just one line below, we were getting invalid xml document errors.