Note that there are some explanatory texts on larger screens.

plurals
  1. POSpringMVC 3 405 - Request method 'POST' not supported
    primarykey
    data
    text
    <p><strong>Controller</strong></p> <pre><code>@Controller public class Tester { @RequestMapping(value="testPost", method = RequestMethod.POST) public ModelAndView testPost(){ ModelAndView _mv = new ModelAndView(); _mv.setViewName("shared/post"); return _mv; } } </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;form action="testPost" method="post"&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt; </code></pre> <p><strong>Web.xml</strong></p> <pre><code>&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt; &lt;display-name&gt;iCubeHRS&lt;/display-name&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;servlet&gt; &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt; &lt;url-pattern&gt;/&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;filter&gt; &lt;filter-name&gt;site_mesh&lt;/filter-name&gt; &lt;filter-class&gt;org.sitemesh.config.ConfigurableSiteMeshFilter&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;site_mesh&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;session-config&gt; &lt;session-timeout&gt;20&lt;/session-timeout&gt; &lt;/session-config&gt; &lt;/web-app&gt; </code></pre> <p><strong>Question</strong></p> <p>Once set "method" attribute to "POST", when you hit submit button, it always turn into 405 - Request method 'POST' not supported, if delete method attribute from conotroller, and delete method="post" from HTML as well, it works, anyone know how to solve this problem?</p> <p><strong>Update</strong></p> <p>I think I found the problem, this issue caused by sitemesh3, after i removed sitemesh3 features from web.xml, POST works fine, but I don't know how to solve it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload