我想通过以下链接访问主页:
<c:url value="/home/home" var="url"/><a href="<c:out value='${url}'/>">Home</a>
主页位于主文件夹中。
但我的堆栈跟踪中有这个错误
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP
request with URI [/myapp/login] in DispatcherServlet with name 'servlet-
context'
正如您所看到的,我甚至没有点击任何带有登录网址的链接,而是发生了什么。当我尝试通过手动键入主URL来执行此操作时,它会更改为登录URL并显示错误页面:
HTTP Status 404 - The requested resource is not available.
我真的不知道为什么登录会在我没有请求时继续出现。
我的控制器
@RequestMapping(value="/", method = RequestMethod.GET)
public String showLogin(ModelMap model) {
logger.info("This is the login page {}.");
return "login";
}
@RequestMapping(value="/home/home", method = RequestMethod.GET)
public String showHome(ModelMap model) {
return "home/home";
}