【问题标题】:Spring boot - Adding JSTL dependency causes a problemSpring boot - 添加 JSTL 依赖会导致问题
【发布时间】:2019-02-09 18:23:35
【问题描述】:

我是 Spring Boot 的新手。我想为 JSP 页面使用 jstl 标签。为此,我添加了以下依赖项

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.6</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap-datepicker</artifactId>
            <version>1.0.1</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>1.9.1</version>
        </dependency>

        <!-- Use MySQL Connector-J -->

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

    </dependencies>

每当我添加 jstl 依赖项时,项目都不会启动,但会在删除它时启动。

在 Apache Tomcat 8.0.27.0 上部署 个人资料模式:假 调试模式:真 force redeploy: true Undeploying ... undeploy?path=/demo OK - 在上下文路径 /demo 取消部署的应用程序就地部署在

运行应用时出现以下错误。

C:\Users\Nishan Dhungana\Documents\NetBeansProjects\SpringBootTest\target\demo-0.0.1-SNAPSHOT deploy?config=file%3A%2FC%3A%2FUsers%2FNISHAN%7E1%2FAppData%2FLocal%2FTemp%2Fcontext3041249382478705791.xml&path=/demo FAIL - 在上下文路径 /demo 部署应用程序但上下文失败 开始

【问题讨论】:

  • 确切的例外是什么?
  • 只想运行应用程序。添加 jstl 依赖项后项目无法启动(部署失败),但在删除它时工作正常
  • 你能发布application.properties的内容吗
  • 您不应该将 添加到所有 Maven 依赖项中吗?我愿意。
  • @benjaminc - 只需 spring.mvc.view.prefix=/WEB-INF/jsp/ spring.mvc.view.suffix=.jsp 这个在 application.properties 上

标签: java spring spring-boot jstl


【解决方案1】:

在您的pom.xml 中也添加此依赖项

<dependency>
     <groupId>jstl</groupId>
     <artifactId>jstl</artifactId>
     <version>1.2</version>
</dependency>

希望对您有所帮助!

【讨论】:

    猜你喜欢
    • 2019-03-18
    • 2017-05-12
    • 2015-08-10
    • 2016-12-12
    • 2015-05-17
    • 1970-01-01
    • 2016-10-18
    • 2019-08-07
    • 1970-01-01
    相关资源
    最近更新 更多