Hello all,
I would like to use GSON for REST*JSON output, can someone please tell me how to configure the ContentNegotiatingViewResolver ?
Actually I have Tiles2 as view resolver and MappingJacksonJsonView as default view for REST:
I will generate JSON in my application code, I just need a way to send the output to the view according to @RequestMapping in controllers.Code:<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="mediaTypes"> <map> <entry key="json" value="application/json"/> <entry key="html" value="text/html"/> </map> </property> <property name="viewResolvers"> <list> <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" /> </bean> </list> </property> <property name="defaultViews"> <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"> <property name="prefixJson" value="false" /> </bean> </property> </bean>
I think there is no MappingGSONJsonView so it would be great if
someone can push me in right direction![]()


Reply With Quote
