[英]HTTP Status 404 The requested resource is not available - springMVC
I'm building spring mvc application with spring security. 我正在使用Spring Security构建Spring MVC应用程序。 This is my url :
这是我的网址:
http://localhost:8080/inbalUI/login HTTP://本地主机:8080 / inbalUI /登录
And I'm getting to my controller : 而且我要去我的控制器:
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginPage() {
if (isCurrentAuthenticationAnonymous()) {
return "login";
} else {
return "login";
// return "redirect:/list";
}
}
This is the log : 这是日志:
20:02:10.823 [http-nio-8080-exec-10] DEBUG org.springframework.web.servlet.view.JstlView - Forwarding to resource [/WEB-INF/views/login.jsp] in InternalResourceView 'login' 20:02:10.825 [http-nio-8080-exec-10] DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession. 20:02:10.823 [http-nio-8080-exec-10]调试org.springframework.web.servlet.view.JstlView-在InternalResourceView'login'中转发到资源[/WEB-INF/views/login.jsp] 20 :02:10.825 [http-nio-8080-exec-10]调试org.springframework.security.web.context.HttpSessionSecurityContextRepository-SecurityContext为空或内容为匿名-上下文不会存储在HttpSession中。 20:02:10.825 [http-nio-8080-exec-10] DEBUG org.springframework.web.servlet.DispatcherServlet - Successfully completed request 20:02:10.825 [http-nio-8080-exec-10] DEBUG org.springframework.security.web.access.ExceptionTranslationFilter - Chain processed normally 20:02:10.825 [http-nio-8080-exec-10] DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed
20:02:10.825 [http-nio-8080-exec-10]调试org.springframework.web.servlet.DispatcherServlet-成功完成请求20:02:10.825 [http-nio-8080-exec-10]调试org.springframework .security.web.access.ExceptionTranslationFilter-链正常处理20:02:10.825 [http-nio-8080-exec-10] DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter-现在清除了SecurityContextHolder,完成了请求处理
This is the login.jsp deploying path on tomcat : 这是tomcat上的login.jsp部署路径:
C:\\me\\apache\\apache-tomcat-8.0.36\\webapps\\inbalUI\\WEB-INF\\classes\\WEB-INF\\views C:\\我\\ apache的\\ Apache的Tomcat的8.0.36 \\的webapps \\ inbalUI \\ WEB-INF \\类\\ WEB-INF \\意见
But I'm getting HTTP Status 404: 但是我正在获取HTTP Status 404:
HTTP Status 404 - /inbalUI/WEB-INF/views/login.jsp type Status report message /inbalUI/WEB-INF/views/login.jsp description The requested resource is not available. HTTP状态404-/inbalUI/WEB-INF/views/login.jsp类型状态报告消息/inbalUI/WEB-INF/views/login.jsp描述所请求的资源不可用。
Apache Tomcat/8.0.36 Apache Tomcat / 8.0.36
Any idea why ? 知道为什么吗?
It seems to me that you use the wrong folder for views. 在我看来,您使用了错误的文件夹进行查看。
According to this article https://vitalflux.com/web-application-folder-structure-spring-mvc-web-projects/ this folder should be at: 根据本文https://vitalflux.com/web-application-folder-structure-spring-mvc-web-projects/,此文件夹应位于:
src/WEB-INF/views/login.jsp
and you probably put it under 而你可能把它放在
src/resources/WEB-INF/views/login.jsp
Which results in WEB-INF/views/login.jsp
being put into the classpath ( classes/WEB-INF/views/login.jsp
) 这导致将
WEB-INF/views/login.jsp
放入类路径( classes/WEB-INF/views/login.jsp
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.