嘿,我有一個在簡單的春季啓動應用程序中查看jsp文件的問題。不斷得到WhiteLabel錯誤頁面 - 春季啓動
這裏是我的項目文件:
的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample</groupId>
<artifactId>boot-sample</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<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.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.3.RELEASE</version>
</plugin>
</plugins>
</build>
HomeController.java
package com.sample;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping("/home")
public String home(){
return "home";
}
}
回到Home.jsp
<%@ page language="java" contentType="text/html" pageEncoding="UTF-8"%>
<html lang="en">
<head>
<h1>Title</h1>
</head>
<body>
<h2>text</h2>
</body>
</html>
個
application.properties
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
我想通了,它可能是在application.properties文件結構或前綴路徑的東西,仍然沒有找到答案,但。
「我有看一個jsp文件有問題」 - 這是什麼問題?請包括一個特定的問題。 – avojak
你在建造你的'jar'還是'war'? – Jaiwo99
下面是一個簡單的例子:https://www.mkyong.com/spring-boot/spring-boot-hello-world-example-jsp/ –