Recently, using the Spring MVC development Project, there was a problem:
Javax.servlet.ServletException:Could not resolve view with name ' OK ' on servlet with Name ' Spring 'At Org.springframework.web.servlet.DispatcherServlet.render (Dispatcherservlet.java:1162) at Org.springframework.web.servlet.DispatcherServlet.doDispatch (Dispatcherservlet.java:950) at Org.springframework.web.servlet.DispatcherServlet.doService (Dispatcherservlet.java:852) at Org.springframework.web.servlet.FrameworkServlet.processRequest (Frameworkservlet.java:882) at Org.springframework.web.servlet.FrameworkServlet.doDelete (Frameworkservlet.java:811) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:643) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:717) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:290) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:206) at Org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal (Hiddenhttpmethodfilter.java: 74) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:76) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:235) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:206) at Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (Characterencodingfilter.java: 88) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:76) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:235) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:206) at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java:233) at Org.apache.catalina.core.StandardContextValve.invoke (Standardcontextvalve.java:191) at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java:127) at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:102) at Org.apache.catalina.core.StandardEngineValve.invoke (Standardenginevalve.java:109) at Org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadapter.java:293) at Org.apache.coyote.http11.Http11Processor.process (Http11processor.java:859) at Org.apache.coyote.http11.http11protocol$http11connectionhandler.process (Http11protocol.java:30W) at Org.apache.tomcat.util.net.jioendpoint$worker.run (Jioendpoint.java:489) at Java.lang.Thread.run (Thread.java:619) ...
Cause of the exception: configured in the MVC configuration file:
<name= "Defaultcontenttype" value= "text/html"/>
and the URL (http://localhost:8080/SpringRestful/services/User/users?_method=delete)
The request does not have an extension, and the requested method does not have a @responsebody signature, and spring will assume that the result of your request is an HTML view, so the above exception is thrown. The workaround is any one of the following: 1.url request plus extension:
Http://localhost:8080/SpringRestful/services/User/users.json?_method=delete
2. Add @responsebody signature 3 on the requested method.
<name= "Defaultcontenttype" value= "text/html"/> Change to <name= "Defaultcontenttype" value= "Application/json" />
Spring mvc-Exception Javax.servlet.ServletException:Could not resolve view with name ' xxx ' in servlets with Name ' Spring '