【问题标题】:While displaying a jsp page in spring boot, it displays along with jsp header file [closed]在spring boot中显示jsp页面时,它与jsp头文件一起显示[关闭]
【发布时间】:2020-03-17 05:20:36
【问题描述】:

在spring boot中显示一个jsp页面时,它会与jsp头文件一起显示......

JSP 页面

<html>
<%@ include page language="java" contentType="text/jsp; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ include taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
  <meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
   Hello World 
</body>
</html>

浏览器输出

<%@ include page language="java" contentType="text/jsp; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ include taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>Hello World 

请帮忙.....

【问题讨论】:

    标签: java spring spring-boot jsp


    【解决方案1】:

    请在 pom.xml 中添加以下依赖项以解决该问题。此依赖完全用于在运行时编译 JSP 页面。

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

    【讨论】:

    • 我已经添加了这个依赖....
    • 请将 contentType "text/jsp 更改为 text/html 并尝试一次。
    • 什么都没发生.....
    猜你喜欢
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-15
    • 1970-01-01
    • 2018-05-08
    • 1970-01-01
    • 2014-06-30
    相关资源
    最近更新 更多