2016-09-08 35 views
1

我有一個「JacketController」有法秀()試圖渲染模型視圖worklist.gspGrails的3.1.10找不到意見

def show() { 
     LOG.debug("JacketController:show()") 
     render(view:"worklist", model:PatientSearchResult.list()) as HTML 
    } 

但每次我打電話的動作,從瀏覽器我得到的錯誤:

[Could not resolve view with name '/jacket/worklist' in servlet with name 'grailsDispatcherServlet'] with root cause StandardWrapperValve.java 250 javax.servlet.ServletException: Could not resolve view with name /jacket/worklist' in servlet with name 'grailsDispatcherServlet'... 

我會認爲這是在告訴我worklist.gsp不存在,或者是放錯了地方,但worklist.gsp是在grails-app /視圖/夾克目錄。

我的網址映射如下所示:

 "/jacket" { 
     controller = { 'jacket' } 
     action = { GET: 'show' } 
    } 

我不知道如果我錯過了一個插件或什麼,但我的build.gradle是在這裏:(原諒格式)

buildscript { 
ext { 
    grailsVersion = project.grailsVersion 
} 
repositories { 
    mavenLocal() 
    maven { url "https://repo.grails.org/grails/core" } 
} 
dependencies { 
    classpath "org.grails:grails-gradle-plugin:$grailsVersion" 
    classpath "org.grails.plugins:hibernate4:5.0.10" 
    classpath "org.grails.plugins:views-gradle:1.0.12" 
    classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.11.2" 
}} configurations.all { 
resolutionStrategy.eachDependency { DependencyResolveDetails details -> 
    if (details.requested.name == 'log4j') { 
     details.useTarget "org.slf4j:log4j-over-slf4j:1.7.5" 
    } 
    if (details.requested.name == 'commons-logging') { 
     details.useTarget "org.slf4j:jcl-over-slf4j:1.7.5" 
    } 

} } 

version "0.1" group "viops"

apply plugin:"eclipse" apply plugin:"idea" apply plugin:"war" apply plugin:"org.grails.grails-web" apply plugin:"org.grails.plugins.views-json" apply plugin:"org.grails.grails-gsp" apply plugin:"asset-pipeline"

ext { grailsVersion = project.grailsVersion gradleWrapperVersion = project.gradleWrapperVersion }

repositories { mavenLocal() maven { url " https://repo.grails.org/grails/core " } }

dependencyManagement { imports { mavenBom "org.grails:grails-bom:$grailsVersion" } applyMavenExclusions false }

dependencies { //This top section pulls out Grails Logback logging solution and //replaces it with log4j2 // added the new way using Log4j2, yes, spring makes it easy compile "org.springframework.boot:spring-boot-starter-log4j2"

// changed spring-boot-autoconfigure so that it would not 
// pull in the logback binding/implementation 
compile('org.springframework.boot:spring-boot-autoconfigure') { 
    exclude group: 'ch.qos.logback', module: 'logback-classic' 
} 
compile ('org.springframework.boot:spring-boot-starter-actuator'){ 
    exclude group: 'ch.qos.logback', module: 'logback-classic' 
} 


// and finally, added the log4j2 binding/implementation 
compile "org.apache.logging.log4j:log4j-api:2.5" 
compile "org.apache.logging.log4j:log4j-core:2.5" 

compile "org.grails:grails-core" 
provided "org.springframework.boot:spring-boot-starter-tomcat" 
compile "org.grails:grails-plugin-url-mappings" 
compile "org.grails:grails-plugin-rest" 
compile "org.grails:grails-plugin-codecs" 
compile "org.grails:grails-plugin-interceptors" 
compile "org.grails:grails-plugin-services" 
compile "org.grails:grails-plugin-datasource" 
compile "org.grails:grails-plugin-databinding" 
compile "org.grails:grails-plugin-async" 
compile "org.grails:grails-web-boot" 
compile "org.grails:grails-logging" 
compile "org.grails.plugins:cache" 
compile "org.grails.plugins:hibernate4" 
compile "org.hibernate:hibernate-ehcache" 
compile "org.grails.plugins:views-json" 
console "org.grails:grails-console" 
profile "org.grails.profiles:rest-api" 
runtime "com.h2database:h2" 
testCompile "org.grails:grails-plugin-testing" 
testCompile "org.grails.plugins:geb" 
testCompile "org.grails:grails-datastore-rest-client" 
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1" 
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18" } 

任何人都可以指向正確的方向嗎?

+1

嘗試包括網絡配置文件依賴 – quindimildev

+0

+ quindimildev謝謝。我所做的是使用Web配置文件創建了一個新項目,並比較了生成的構建文件。我引入了REST配置文件中缺少的依賴關係,並註釋了可能有衝突的一對。現在工作。 – Speck

+0

歡迎您,回答自己,並標記爲已解決;) – quindimildev

回答

0

quindimildev在評論中發佈了答案。

我應該創建一個應用程序與Web配置文件開始。因此,我使用Web配置文件創建了一個新項目,並將生成的構建文件與現有應用程序進行比較。

我引入了REST配置文件中缺少的依賴關係,並註釋了可能發生衝突的一對。