在运行启动应用程序时,出现白标签错误页面
1)我的控制器类是
package com.st.spring.boot.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HelloWorldController {
@Value("${custom.prop}")
private String var;
@GetMapping("/helloWorld")
public String helloWorld(Model model) {
model.addAttribute("name", "Spring Boot");
return "helloWorldDynamic";
}
}
2)主类是
package com.st.spring.boot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
3)pom.xml具有
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- tomcat-embed-jasper is needed for jsp rendering -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
4)application.properties具有
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
server.port: 8081
custom.prop: Spring Boot Custom Property
->在WEB-INF / jsp中,有一个名为helloWorldDynamic.jsp的.jsp文件
->在运行主类时,我正在获得whitelabel错误页面并在IDE中 下面的错误来了。 ->我使用的网址是http://localhost:8081/helloWorld
2m2019-05-24 16:47:58.050 INFO 4244 --- [nio-8081-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2019-05-24 16:47:58.050 INFO 4244 --- [nio-8081-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2019-05-24 16:47:58.107 INFO 4244 --- [nio-8081-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 57 ms
2019-05-24 16:48:02.679 ERROR 4244 --- [nio-8081-exec-2] o.a.c.c.C.[.[localhost].[/].[jsp] : Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException:javax.el.ELResolver