【问题标题】:spring boot jsps not getting renderedspring boot jsps没有被渲染
【发布时间】:2014-05-10 16:58:16
【问题描述】:

我的构建 gradle 看起来像这样

buildscript {
    repositories {
        maven { url "http://repo.spring.io/libs-milestone" }
        mavenLocal()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.0.RC5")
    }
}

configurations {
    jasper
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'

war {
    baseName = 'foo-serving-web-content'
    version =  '0.1.1'
}

repositories {
    mavenCentral()
    maven { url "http://repo.spring.io/libs-milestone" }
}

dependencies {
    compile("org.springframework:spring-webmvc:4.0.0.M2")
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("javax.servlet:javax.servlet-api:3.1.0")
    compile("javax.servlet:jstl:1.1.2")
    testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
    gradleVersion = '1.11'
}

现在问题是我的 jsps 没有被渲染,只是普通的 XML。 我发现这篇文章有人有问题,但他们使用的是 maven。

JSP file not rendering in Spring Boot web application

我的 build.gradle 有什么问题吗?

【问题讨论】:

    标签: gradle spring-boot


    【解决方案1】:

    有几处看起来不对:

    1. 您不需要“spring-webmvc”作为显式依赖项,而且您使用的是非常旧的版本。不用管它,你会得到 4.0.3。

    2. 您还没有包含 Jasper(尽管看起来您打算使用“jasper”配置)-example here(它是 maven,但您会明白的)。

    3. 您尚未将 tomcat 依赖项标记为“providedRuntime”(see here for example,因此我假设您不需要可部署的 WAR。

    您可能应该解决所有这些问题,但如果您只做一个子集,您可能会得到一些工作。

    【讨论】:

    • 我的 build.gradle 现在看起来像这样 pastie.org/8982991 现在得到“HTTP 状态 500 - 绝对 uri:java.sun.com/jsp/jstl/core 无法在 web.xml 或使用此应用程序部署的 jar 文件中解析”
    • 我认为我们不支持 servlet 3.1,而且您的 jstl 看起来很旧。在没有显式版本的情况下尝试这些依赖项,让 Boot 插件为您解决它们。
    猜你喜欢
    • 2011-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-06
    • 2017-04-28
    • 1970-01-01
    • 2014-08-25
    相关资源
    最近更新 更多