How can we call requestmethod=POST in Spring MVC?
<p>I am trying to Post "fromdate" and "todate" to get messages. When I run the code below it is saying "noHandlerFound". All the get methods are working fine but not Post methods.</p>

<p>HTML:</p>

<pre><code>&lt;form name="filtersForm" action="/SpringApp/getmessages" method="post"&gt;
    From Date: &lt;input name="fromDate" type="date" value="01-01-2015" /&gt;
    To Date: &lt;input name="toDate" type="date" value="01-03-2015" /&gt;
    &lt;input name="submit" type="submit" value="submit" /&gt;
&lt;/form&gt;
</code></pre>

<p>Spring controller code:</p>

<pre><code>@RequestMapping(value = "/getmessages", method = RequestMethod.POST)
public String getMessages(@RequestParam("fromDate") String start_dt, 
                          @RequestParam("toDate") String end_dt,
                          ModelMap model) {
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
    Date fromDate, toDate;
    try {
        fromDate = sdf.parse(start_dt);
        toDate = sdf.parse(end_dt);
        model.put("messagesList", appservice.getMessages(fromDate, toDate));
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return "home";
}
</code></pre>

<p>When I run this code I am getting following error:</p>

<blockquote>
  <p>org.springframework.web.servlet.PageNotFound noHandlerFound</p>
  
  <p>WARNING: No mapping found for HTTP request with URI [/SpringApp/403] in DispatcherServlet with name 'mvc-dispatcher'</p>
</blockquote>

<p>WEB.XML file:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
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;MonitorApp&lt;/display-name&gt;

&lt;context-param&gt;
    &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
    &lt;param-value&gt;
        /WEB-INF/spring-security.xml,
        /WEB-INF/applicationContext.xml,
    &lt;/param-value&gt;
&lt;/context-param&gt;

&lt;listener&gt;
    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
&lt;/listener&gt;
&lt;servlet&gt;
    &lt;servlet-name&gt;mvc-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;mvc-dispatcher&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;

&lt;!-- Spring Security --&gt;
&lt;filter&gt;
    &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
    &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
&lt;/filter&gt;

&lt;filter-mapping&gt;
    &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/filter-mapping&gt;
</code></pre>

<p></p>

<p>Spring Security:</p>

<pre><code>&lt;beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.1.xsd"&gt;

&lt;http auto-config="true" use-expressions="true"&gt;
    &lt;intercept-url pattern="/**" requires-channel="http" /&gt;
    &lt;intercept-url pattern="/"
        access="hasAnyRole('ROLE_ADMIN','ROLE_USER')" /&gt;
    &lt;intercept-url pattern='/login' access='isAnonymous()' /&gt;
    &lt;!-- access denied page --&gt;
    &lt;access-denied-handler error-page="/403" /&gt;

    &lt;form-login login-page="/login" default-target-url="/home"
        authentication-failure-url="/login?error" login-processing-url="/j_spring_security_check"
        username-parameter="username" password-parameter="password" /&gt;

    &lt;logout logout-success-url="/login?logout" logout-url="/j_spring_security_logout" /&gt;
    &lt;!-- enable csrf protection --&gt;
    &lt;csrf /&gt;
&lt;/http&gt;


&lt;authentication-manager&gt;
    &lt;authentication-provider&gt;
        &lt;user-service&gt;
            &lt;user name="admin" password="admin" authorities="ROLE_ADMIN" /&gt;
            &lt;user name="user" password="user" authorities="ROLE_USER" /&gt;
        &lt;/user-service&gt;
    &lt;/authentication-provider&gt;
&lt;/authentication-manager&gt;
</code></pre>

<p></p>

<p>ApplicationContext:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:jms="http://www.springframework.org/schema/jms"
xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.3.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    http://www.springframework.org/schema/jdbc
    http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd
    http://www.springframework.org/schema/jee
    http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
    http://activemq.apache.org/schema/core
    http://activemq.apache.org/schema/core/activemq-core-4.3.xsd
    http://www.springframework.org/schema/jms 
    http://www.springframework.org/schema/jms/spring-jms-4.3.xsd"&gt;

&lt;context:annotation-config /&gt;
&lt;context:component-scan base-package="com.someapp" /&gt;
&lt;tx:annotation-driven /&gt;
&lt;bean
    class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /&gt;

&lt;bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;

    &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /&gt;
    &lt;property name="url" value="jdbc:oracle:thin:@172.28.12.31:1521:fsdev" /&gt;
    &lt;property name="username" value="cybercodesqat" /&gt;
    &lt;property name="password" value="welcome123" /&gt;
&lt;/bean&gt;

&lt;bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
    p:dataSource-ref="dataSource" p:persistenceUnitName="MonitorJpaPersistenceUnit" /&gt;

&lt;bean
    class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;

&lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
    p:entityManagerFactory-ref="entityManagerFactory" /&gt;

&lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
</code></pre>

<p></p>