So I'm getting an warning as
WARN [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] (default task-2) Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported]
when I go to the following URL http://localhost:8080/ProjectFE/uregistration
and the website shows
HTTP 405 Method not allowed
here is my controller code:
package controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import model.daoimpl.UserinfoDaoImpl;
import model.dao.IUserinfoDAO;
import model.entity.Userinfo;
@Controller
public class RegistrationController {
@RequestMapping(value="/registration",method = RequestMethod.GET)
public String addRegistrationPage() {
return "registrationpage";
}
@RequestMapping(value="/uregistration",method = RequestMethod.POST)
public String addURegistrationPage(@ModelAttribute("User")Userinfo u) {
IUserinfoDAO iu = new UserinfoDaoImpl();
boolean b = iu.insertInfo(u);
if(b)
return "success";
else
return "registrationpage";
}
}
So what should I do ? Also if any other code is required please comment I'll edit the post, Thankyou.