2007-10-09

grails 模板

关键字: grails,groovy
在使用grails的command来开发程序的时,经常使用的命令有

grails create-domain-class | create-controller 等
这些命令产生的 Domain 和 Controller 不是很有用,也就是说,不能够定制我们需要的

这个时候,template就起作用了
具体使用
1)
grails install-templates

2)在你的应用程序的src目录下面就有了templates
修改controller对应的就是 artifacts\Controller.groovy
groovy 原始代码
 
  1. class @artifact.name@ {  
  2.   
  3.     def index = { }  
  4. }  

修改成我么需要的就可以
java 代码
 
  1. class @artifact.name@ extends YourController{  
  2.   
  3.      def index = { }  
  4. }  

这样,生产的 Domain Class就有了
使用起来
评论
agile_boy 2007-10-11
好建议,不过如果升级Grails的话,你做的改动要被覆盖掉了:)
发表评论

您还没有登录,请登录后发表评论

dellsoft
搜索本博客
我的相册
5d0d42bc-4234-4e78-9bcd-e51aa5ccf380-thumb
detail
共 1 张
存档
最新评论