简体   繁体   English

将 jsp 添加到 spring 引导项目

[英]Adding jsp to spring boot project

I am starting a new project and I am trying to configure spring boot as a web project to use jsp's.我正在开始一个新项目,我正在尝试将 spring 引导配置为 web 项目以使用 jsp。 I am using Spring Tools Suite 4.我正在使用 Spring 工具套件 4。

I have added the spring web option while setting up.我在设置时添加了 spring web 选项。

I have added the following in the application.properties我在 application.properties 中添加了以下内容

spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp

I have also have the following dependencies in my pom file我的 pom 文件中也有以下依赖项

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <!-- Need this to compile JSP -->
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
</dependencies>

When I try to add a tsp to the main/webapp/WEB-INF/jsp folder I dont get the jsp option.当我尝试将 tsp 添加到 main/webapp/WEB-INF/jsp 文件夹时,我没有得到 jsp 选项。

在此处输入图像描述

Try installing the plugin from eclipse marketplace尝试从 eclipse 市场安装插件

Go to help -> eclipse marketplace Go帮助-> eclipse 市场

Then search Eclipse Java EE Developer Tools然后搜索Eclipse Java EE Developer Tools

Install it and restart your IDE安装它并重新启动您的 IDE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM