grails - 如何从Grails应用程序中的gsp重定向到 Controller 的 Action

标签 grails redirect controller gsp

我的要求是,我在检查条件的地方使用<g:if>标记时有一个gsp。
如果满足该条件,则必须将控件自动重定向到 Controller 中的某个 Action 。
我该如何实现?

提前致谢。

最佳答案

您可以像这样使用JavaScript:

<g:if ...>
<g:javascript>
window.location.href = '<g:createLink ... >';
</g:javascript>
</g:if>

顺便说一句,在 Controller 本身中做起来要容易得多,也更好。

关于grails - 如何从Grails应用程序中的gsp重定向到 Controller 的 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14978709/

相关文章:

grails - 在 Grails 中以 DRY 方式动态构建 createCriteria?

grails - Grails 的 ActiveMQ 插件接管 SSL 连接?

json - 在 Grails 中仅输出日期 + 时间的日期部分

redirect - 如何在 directadmin 保持 HTTPS/SSL 的情况下将域 B 指向域 A 而无需重定向?

grails - Grails Async OnError(){}

php - 重定向后重新填写表格

C#通过进程通过cmd调用带有错误重定向和exe的批处理

model-view-controller - Zend Controller 的预调度方法

ruby-on-rails - 销毁 rails 中的所有 Controller Action

testing - 如何在 Yii 中对 Controller 进行单元测试