I've been tinkering on this error ever since Friday and until now I still haven't fixed it. I've based this SpringMVC project on an assignment that I've worked on last year that works. And added a few new things. So I have this login page, I didn't add yet the security. I just wanted to see if my FrontEnd and BakcEnd will meet if I do transaction such as checking the user if it exists on the Database and forward it to the mainpage if it does. Here are some codes snippets:
For the TestController.java
@Controller
public class TestController {
@Autowired
private UserService userService;
@RequestMapping(value = "index")
public ModelAndView index(HttpServletRequest request, ModelMap model) {
System.out.println("Index !");
return new ModelAndView("index", "user", new User());
}
@RequestMapping(value = "login", method = RequestMethod.POST)
public ModelAndView login(HttpServletRequest request,
HttpServletResponse res) {
System.out.println("inside login");
String userName = request.getParameter("username");
String password = request.getParameter("password");
System.out.println(userName);
System.out.println(password);
User user = new User();
user.setUsername(userName);
user.setPassword(password);
if (userService.userLogin(user)) {
return new ModelAndView("mainpage");
} else {
return new ModelAndView("index");
}
}
The index.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<html>
<head>
<title>KSPEAK CMS V1.0</title>
<!-- Bootstrap core CSS -->
<link href="<c:url value='/resources/bootstrap/css/bootstrap.min.css'/>"
rel="stylesheet">
<!-- Custom styles for this template -->
<link href="<c:url value='/resources/bootstrap/css/signin.css'/>"
rel="stylesheet">
<body>
<div class="container">
<form:form class="form-signin" method="POST" action="login" commandName="user" >
<h2 class="form-signin-heading">Please sign in</h2>
<label for="inputUserName" class="sr-only">UserName</label> <form:input
type="text" name="username" class="form-control" path="username"
placeholder="UserName" required="required" autofocus="autofocus"/> <label
for="inputPassword" class="sr-only">Password</label> <form:input
type="password" name="password" class="form-control" path="password"
placeholder="Password" required="required"/>
<input class="btn btn-lg btn-primary btn-block" type="submit" value="login">
</form:form>
</div>
</body>
</head>
</html>
My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-a pp_2_5.xsd">
<servlet>
<servlet-name>myBatisServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springConfig.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myBatisServlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>
My SpringConfig.xml (I've redacted some things on this part because it messes with the layout of the post it's just the xmlns and schema locations)
<mvc:annotation-driven />
<context:component-scan base-package="com.cms.*" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:hsql://localhost:9001/" />
<property name="username" value="SA" />
<property name="password" value="" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="typeAliasesPackage" value="com.cms.model" />
<property name="mapperLocations" value="classpath*:com/cms/mappers/*.xml" />
</bean>
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.cms.mappers" />
</bean>
</beans>
When running the app. It successfully loads the index.jsp and pass through my first sysout on the controller. As shown below:

Let's say I've entered an existing user it should redirect to the mainpage. But here's a picture of what it does 
It doesn't go the login method I've placed on the controller.
Somethings that I had done so far is adding / to the value of the @RequestMapping for login but still same error. Tried manually typing the login to the url bar same error, tried to create another method in the controller same error. As far as what can I see it only recognizes the index. So yeah, I think I need some help. As per usual I can upload any files from my project that you need to see. Thanks.
*.html, but your controller urls are extensionless.