Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have always done this using the ContentNegotiatingViewResolver. It seems that it is not understanding the content type that you are passing it. This is the configuration that I typically use for doing what you are trying to do:</p> <pre><code>&lt;bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt; &lt;property name="order" value="1" /&gt; &lt;property name="contentNegotiationManager"&gt; &lt;bean class="org.springframework.web.accept.ContentNegotiationManager"&gt; &lt;constructor-arg&gt; &lt;bean class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy"&gt; &lt;constructor-arg&gt; &lt;map&gt; &lt;entry key="json" value="application/json" /&gt; &lt;entry key="xml" value="application/xml" /&gt; &lt;/map&gt; &lt;/constructor-arg&gt; &lt;/bean&gt; &lt;/constructor-arg&gt; &lt;/bean&gt; &lt;/property&gt; &lt;property name="defaultViews"&gt; &lt;list&gt; &lt;bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" /&gt; &lt;bean class="org.springframework.web.servlet.view.xml.MarshallingView"&gt; &lt;constructor-arg&gt; &lt;bean class="org.springframework.oxm.xstream.XStreamMarshaller"&gt; &lt;property name="autodetectAnnotations" value="true" /&gt; &lt;/bean&gt; &lt;/constructor-arg&gt; &lt;/bean&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>This video goes through doing exactly what you are trying to do with consuming the service through jQuery in the UI:</p> <p><a href="http://pluralsight.com/training/Courses/TableOfContents/springmvc-intro" rel="nofollow">http://pluralsight.com/training/Courses/TableOfContents/springmvc-intro</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload