Grails中的视图和模板之间的区别 [英] Difference between view and template in Grails
本文介绍了Grails中的视图和模板之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
基本模板是视图的一个(可重用)部分。用于将View分解为逻辑部分和/或从不同视图重复使用相同的代码。
所以,如果您要渲染整个页面 - 请使用View。如果你只需要一小部分 - 使用模板。查看文档视图和模板 - http://grails.org/doc/latest/guide/theWebLayer.html#viewsAndTemplates
In a Grails app, I am trying to figure out when to use a view and when to use a template for a gsp. Are there any obvious reasons? Or does it just come down to reuse?
解决方案
Basically Template is a (reusable) part of a View. Useful for splitting View into logical parts and/or for reusing same code from different views.
So, if you're rendering a whole page - use View. If you need just a small part - use Template.
See docs for Views and Templates - http://grails.org/doc/latest/guide/theWebLayer.html#viewsAndTemplates
这篇关于Grails中的视图和模板之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文