* .Html suffix can not solve request the return of json data (SpringMVC project report tomcat 406 error)

SpringMVC project 406 error:

When a data request returns json
tomcat given

The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request “accept” headers.

Chinese explanation:
resource identified by the request is only capable of generating a "accept" response header unacceptable characteristics according to the request.

Reason: * .html request may not be returned in the springmvc json data.
For these reasons, we can use some Solutions,

1. json jar package is not installed.

Look json file has no dependencies, if not, pom file to the jar package

<!-- Jackson Json处理工具包 -->
			<dependency>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-databind</artifactId>
				<version>${jackson.version}</version>
			</dependency>

2. Request URL ends in .html. (Modify web.xml, add url interception format.)

Change in place js-generation request to .action ending
Here Insert Picture Description
accepted on request web.xml plus .action
Here Insert Picture Description

Published 15 original articles · won praise 0 · Views 496

Guess you like

Origin blog.csdn.net/qq_36335126/article/details/103941088