Why SpringMVC Request method 'GET' not supported?

I trying @RequestMapping(value = "/test", method = RequestMethod.POST) but is error

Code is

 public class HelloWordController {
 private Logger logger = LoggerFactory.getLogger(HelloWordController.class);

 @RequestMapping(value = "/test", method = RequestMethod.POST)
 public String welcome() {"Spring params is welcome");
  return "/WEB-INF/jsp/welcome";


web.xml is

<description>This is Spring MVC DispatcherServlet</description>
<servlet-name>SpringMVC DispatchServlet</servlet-name>

<servlet-name>SpringMVC DispatchServlet</servlet-name>

and springmvc.xml is

index.jsp is

<form action="<%=request.getContextPath() %>/test" method="post">
<input type="submit" value="submit"> 

I input submit botton brower is error

HTTP Status 405 - Request method 'GET' not supported type Status report

message Request method 'GET' not supported

description The specified HTTP method is not allowed for the requested resource (Request method 'GET' not supported).


  • Change

    @RequestMapping(value = "/test", method = RequestMethod.POST)


    @RequestMapping(value = "/test", method = RequestMethod.GET)