Even though I've mapped a controller to handle a URI, I get: No mapping found for HTTP request with URI [/login]. Below are my dispatcher servlet configuration and the controller class; anyone see what is causing the error?
Code:<servlet> <servlet-name>dispatcher-servlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher-servlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>Code:import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/login") public class LoginController { @RequestMapping(value="/") public String loginView() { return "login"; } @RequestMapping(value="/{error}") public ModelAndView loginErrorView(@PathVariable("error") String error) { ModelAndView mav = new ModelAndView(); mav.setViewName("login"); mav.addObject("error", error); return mav; } }


Reply With Quote
