我如何渲染到其他控制器的gsp视图? [英] how can i render to the gsp view of other controller?
问题描述
$ b
我刚刚为一个小应用程序开始, b $ b
任何人都可以告诉我如何从当前控制器视图页面呈现给其他控制器的GSP视图页面。
随着advance的提前致谢,
Laxmi.P
假设您想要从SecondController的$
的normalView.gsp呈现FirstController的finalView.gsp具有以下结构:
FirstController.groovy
finalView.gsp
SecondController.groovy
normalView.gsp
normalView.gsp将包含:
< g:link controller =SecondControlleraction =redirectToFirstController>重定向到finalView.gsp< / g:link>
然后在你的SecondController中定义一个名为redirectToFirstController的动作
def redirectToFirstController = {
redirect(controller:FirstController,action:renderFinalView)
}
并在您的FirstController中:
def renderFinalView = {
render(view:finalView);
}
I m new to grails,just started with a small application,
I'm searching a solution for below problem,
Can any one tell me how can i render to GSP view page of other controller from current controller view page.
With advance Thanks, Laxmi.P
Lets suppose you want to render finalView.gsp of FirstController from normalView.gsp of SecondController having the following structure :
FirstController.groovy
finalView.gsp
SecondController.groovy
normalView.gsp
normalView.gsp will have :
<g:link controller="SecondController" action="redirectToFirstController">Redirect to finalView.gsp </g:link>
Then inside your SecondController, define one action called redirectToFirstController
def redirectToFirstController = {
redirect(controller:"FirstController",action:"renderFinalView")
}
And inside your FirstController:
def renderFinalView = {
render(view:"finalView");
}
这篇关于我如何渲染到其他控制器的gsp视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!