后端-框架-Spring MVC-多视图解析器

业务要求

通过Request所请求的格式进行Response的格式

<beans>
	
	<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
		<property name="favorParameter" value="true"/>
		<property name="mediaTypes">
			<map>
				<entry key="html" value="text/html;charset=UTF-8"/>
				<entry key="json" value="application/json;charset=UTF-8"/>
				<entry key="xml" value="application/xml;charset=UTF-8"/>
			map>
		property>
		<property name="viewResolvers">
			<list>
				<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
					<property name="prefix" value="/WEB-INF/jsp/"/>
					<property name="suffix" value=".jsp"/>
				bean>
			list>
		property>
	bean>
beans>

你可能感兴趣的:(后端,框架,Spring,后端,框架,Spring,MVC,多视图解析器)