静态脚手架,生成和定制客户化代码
1、首先生成静态脚手架代码
方法一:
grails generate-all com.grailsinaction.User
这样会生成User对象的所有controller方法和view视图,如果系统中已经有User的Controller,生成时会提示是否覆盖
方法二:
grails generate-views com.grailsinaction.User
这样只生成view视图
生成的Controller包括如下action
action名 |
功能 |
渲染的视图 |
index |
定向到list() |
N/A |
list |
分页显示实体 |
list.gsp |
show |
显示一个域类的实例 |
show.gsp |
delete |
得到实体ID,根据ID删除 |
N/A |
edit |
得到实体ID,显示并编辑实体,并提交给update() |
edit.gsp |
update |
更新一个给定ID的实体,跳转到list()或者edit() |
None |
create |
创建一个新的实体,并提交给save() |
create.gsp |
save |
保存一个新的实体,跳转到list()或者create() |
N/A |
当我们修改了css后,使用generate生成的静态脚手架界面已经不符合基本的操作要求了,每个操作界面都作大幅度的调整还不如自己一个界面一个界面的写,那样工作量就太大了。所以,grails提供了客户化脚手架模板的方法,定义我们自己的UI生成器,这也是企业级开发推荐的手段
2、客户化脚手架
系统会在/src/templates生成模板代码,供我们修改,至于怎么改,还要看界面功底啊,好像grails插件列表中有一个已经改好了的插件可以拿来使用
分享到:
相关推荐
groovy-grails-tool-suite-3.6.4.RELEASE-e4.4.2-win32-x86_64.part1 共两个压缩包,解压后将扩展名.zip.bak改为.zip再次解压。
elasticsearch-grails-plugin, 恢复的ElasticSearch grails插件 Elasticsearch插件插件这个项目是一个基于Elasticsearch的插件,这个项目是基于的人完成的伟大工作的。你为什么想要为原来的Elasticsearch插件提供...
groovy-grails-tool-suite-3.6.4.RELEASE-e4.4.2-win32-x86_64.part2 共两个包,解压后需要将扩展名.zip.bak改名为.zip重新解压。 http://dist.springsource.com/release/STS/3.8.1.RELEASE/dist/ e4.6/spring-tool-...
Grails In Action.pdf ebook
Grails in Action pdf
Getting-Started-with-Grails-Chinese,一本不错的grails入门书籍,希望对有志于grails的朋友们有用。
Grails in Action - Presentation pdf
Grails in Action Grails in Action Grails in Action Grails in Action Groovy in Action Grails in Action Grails in Action Groovy in Action Groovy in Action
Grails In Action 2009最新版,英文的。很详细,学习groovy和grails的不二之选。
ant-1.9.4jarant-antlr-1.9.4.jarant-junit-1.9.4jar ant-launcher-1.9.4.jar bsf-2.4.0.jar commons-cli-1.2jar commons-logging-1.2.jar gpars-1.2.1.jar groovy-2.4.5jar groovy-ant-2.4.5.jar ...
Grails入门指南中文pdf -- 针对grails1.0.4更新,附加idea8 开发grails的流程
基于java的动态语言Groovy 构建的敏捷web开发框架grails经典入门教程
wsdl2java源码 请注意,当前的 3.x 版本使用 cxf 3.0.4 并且需要 WSS4J ...grails-app\endpoints** 和 grails-app\services** 目录中自动装配配置的类 端点创建脚本 create-endpoint 和 create-endpoin
实测可用
实测可用
实测可用
实测可用