为了账号安全,请及时绑定邮箱和手机立即绑定

Spring Boot 无法呈现(非常)简单的 index.jsp

Spring Boot 无法呈现(非常)简单的 index.jsp

心有法竹 2021-09-12 19:46:20
我正在尝试渲染一个 html .jsp,其中只有一个 h1 标签......感觉它应该可以工作,但它没有。如何让 index.jsp 文件呈现到我的浏览器中?请帮忙!我正在使用:Maven 3.5.4 Java 1.8.0_181 STS 版本:3.9.5.RELEASE<%@ page language="java" contentType="text/html; charset=ISO-8859-1"    pageEncoding="ISO-8859-1"%><%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %><!DOCTYPE html><html><head><meta charset="ISO-8859-1"><title>Insert title here</title></head><body>    <h1> hello</h1></body></html>我成功登录到被命中的路由,但没有读取 index.jsp。package com.coding.test1;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;@SpringBootApplication@Controllerpublic class Test1Application {    public static void main(String[] args) {        SpringApplication.run(Test1Application.class, args);    }    @RequestMapping("/")    public String index() {        System.out.println("+++++hit main+++++++");        return "index.jsp";    }}日志+++++命中主要++++++++浏览器显示Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Mon Sep 10 20:49:47 PDT 2018There was an unexpected error (type=Not Found, status=404).No message available应用程序属性spring.mvc.view.prefix=/WEB-INF/块引用
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 304 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信