Spring MVC Controller geben HTML zurück
Beim Versuch, HTML an meinen Spring MVC-Controller zurückzugeben, ist ein Problem aufgetreten.
Es sieht aus wie das:
@RequestMapping(value = QUESTION_GROUP_CREATE_URL, method = RequestMethod.POST)
public
@ResponseBody
String createQuestionGroup(@RequestBody JsonQuestionGroup questionGroup, HttpServletResponse response) {
// questionGroup - this comes OK.
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
return "<div></div>";
}
Meine Frühlingskonfiguration:
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="false"/>
<property name="favorParameter" value="true"/>
<property name="mediaTypes">
<value>
json=application/json
xml=application/xml
html=application/html
</value>
</property>
</bean>
Ich sehe einen Firebug, dessen Antwort wie folgt lautet:{"String":"<div></div>"}
Wie kann ich dieser Methode mitteilen, dass sie mir einfaches HTML als Antwort sendet?