I am getting the following warning: Request method 'POST' not supported.
Controller method:
@Controller
public class UserServiceController {
@RequestMapping(value = "/login", method = RequestMethod.POST)
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public String login(@RequestParam Map<String,String> requestParams) throws Exception{
System.out.println(requestParams.values());
loginService.userAuthentication(requestParams.get("loginuname"), requestParams.get("loginpassword"));
System.out.println("Before return");
return "static/profile.html";
}
}
Dispatcher-servlet.xml
<mvc:resources mapping="/static/**" location="/WEB-INF/static/" />
index.html
<script language="javascript" type="text/javascript">
function submitForm(){
document.login.submit();
}
</script>
<div id="login" class="login">
<form action="http://localhost:8080/SampleApp/login" name="login" method="post">
<input type="text" value = "Email" name="loginuname" id="loginuname" class="loginbasetxt">
<input type="text" value="Password" name="loginpassword" id="loginpassword" class="loginbasetxt">
<img src="static/img/tb-login-button.png" onclick="submitForm()"/>
</form>
</div>
However, if i would change the method=RequestMethod.GET and correspondingly at login page then it would work.
Please note, problem is at return "static/profile.html";
FYI location of profile.html is WEB-INF/static/
Thanks!!