无法在IntelliJ中的Spring Boot应用程序中运行jsp页面

时间:2017-02-06 20:12:57

标签: spring jsp intellij-idea spring-boot

我一直在尝试运行一个用IntelliJ IDE编写的基本Spring应用程序。这是一个基本的Hello World应用程序,我一直在关注一个教程。我在这里无法解决的是,我刚刚添加了以下依赖项,以便能够在Spring App中运行.jsp页面。

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>

下面是日志:

2017-02-06 22:06:57.294 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/login]
2017-02-06 22:06:57.294 DEBUG 6320 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /login
2017-02-06 22:06:57.295 DEBUG 6320 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public java.lang.String com.orcunyilmaz.springboot.web.controller.LoginController.loginMessage()]
2017-02-06 22:06:57.295 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/login] is: -1
2017-02-06 22:06:57.296 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.s.v.ContentNegotiatingViewResolver : Requested media types are [text/html, application/xhtml+xml, image/webp, application/xml;q=0.9, */*;q=0.8] based on Accept header types and producible media types [*/*])
2017-02-06 22:06:57.296 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.servlet.view.BeanNameViewResolver  : No matching bean found for view name '/login'
2017-02-06 22:06:57.296 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.s.v.ContentNegotiatingViewResolver : Returning [org.springframework.web.servlet.view.InternalResourceView: name '/login'; URL [/WEB-INF/jsp//login.jsp]] based on requested media type 'text/html'
2017-02-06 22:06:57.296 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Rendering view [org.springframework.web.servlet.view.InternalResourceView: name '/login'; URL [/WEB-INF/jsp//login.jsp]] in DispatcherServlet with name 'dispatcherServlet'
2017-02-06 22:06:57.297 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.servlet.view.InternalResourceView  : Forwarding to resource [/WEB-INF/jsp//login.jsp] in InternalResourceView '/login'
2017-02-06 22:06:57.298 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/WEB-INF/jsp/login.jsp]
2017-02-06 22:06:57.298 DEBUG 6320 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /WEB-INF/jsp/login.jsp
2017-02-06 22:06:57.299 DEBUG 6320 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/WEB-INF/jsp/login.jsp]
2017-02-06 22:06:57.299 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.s.handler.SimpleUrlHandlerMapping  : Matching patterns for request [/WEB-INF/jsp/login.jsp] are [/**]
2017-02-06 22:06:57.299 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.s.handler.SimpleUrlHandlerMapping  : URI Template variables for request [/WEB-INF/jsp/login.jsp] are {}
2017-02-06 22:06:57.299 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapping [/WEB-INF/jsp/login.jsp] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2e59cce9]]] and 1 interceptor
2017-02-06 22:06:57.299 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/WEB-INF/jsp/login.jsp] is: -1
2017-02-06 22:06:57.300 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2017-02-06 22:06:57.300 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Successfully completed request
2017-02-06 22:06:57.300 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Successfully completed request
2017-02-06 22:06:57.301 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/error]
2017-02-06 22:06:57.301 DEBUG 6320 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /error
2017-02-06 22:06:57.302 DEBUG 6320 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)]
2017-02-06 22:06:57.303 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/error] is: -1
2017-02-06 22:06:57.314 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.s.v.ContentNegotiatingViewResolver : Requested media types are [text/html, text/html;q=0.8] based on Accept header types and producible media types [text/html])
2017-02-06 22:06:57.314 DEBUG 6320 --- [nio-8080-exec-5] o.s.w.s.v.ContentNegotiatingViewResolver : Returning [org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$SpelView@75420106] based on requested media type 'text/html'
2017-02-06 22:06:57.314 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Rendering view [org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$SpelView@75420106] in DispatcherServlet with name 'dispatcherServlet'
2017-02-06 22:06:57.314 DEBUG 6320 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Successfully completed request

localhost:8080 / login总是显示此页面: enter image description here

我进行了一些搜索,并意识到我无法将我最后添加的jar(来自依赖项)应用于项目。但我也找不到如何添加它。

我相信我需要在项目中添加新工件。我在互联网上找到的答案并未提供我需要点击或更改的确切位置。所以任何帮助将不胜感激。 enter image description here

1 个答案:

答案 0 :(得分:0)

问题是IntelliJ。只需重新启动ide。