【发布时间】:2012-10-07 20:18:11
【问题描述】:
你好..我正在使用 Grails 2 并尝试实现从 gsp 页面到我的控制器的 ajax 调用..首先 grails 2 中缺少库原型我使用命令 grails install-plugin prototype 解决了这个问题..现在错误没有出现但无法正常工作,并且出现了不同的错误..
我在这里附上了代码..如果我更改第一个,我正在尝试简单更新第二个选择框
我还在 Config.groovy 中添加了 grails.views.javascript.library = "prototype" 这一行
<code>
//Controller<br>
def ajaxgetStrudents() {
def college=College.get(params.id)
render college?.students as JSON
}
//GSP<br>
javascript library="prototype" plugin="prototype"<br>
<g:select id="name" name="name" from="${collegeNames.name }"
onChange="${ remoteFunction(controller:'College', action:'ajaxgetStrudents',
, onComplete: 'updateStudent(e)',params :'\'id=\'+this.value '
)}
`</code>
我编写了 javascript 代码来填充学生选择框..此代码不起作用..在控制台中出现这样的错误
` Error 2012-10-08 01:16:57,933 [http-bio-8083-exec-6] ERROR [/SampleGrails].[default] - Servlet.service() for servlet [default] in context with path [/SampleGrails] threw exception
Message: It looks like you are missing some calls to the r:layoutResources tag. After rendering your page the following have not been rendered: [defer]
Line | Method
->> 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 |在 java.util.concurrent.ThreadPoolExecutor$Worker 中运行 ^ 722 |跑步 。 . .在 java.lang.Thread `
首先我想运行这段代码..??
接下来,即使我安装了未添加到我的项目插件文件夹中的原型插件..但它显示在 grails list-plugin -installed 命令中..为什么它是..??
谢谢..,
【问题讨论】:
标签: ajax prototype grails-plugin grails-2.0 grails-controller