内容摘要:Spring Web Flow是Spring家族中的一位成员,他能简化Web应用的开发。在Grails0.6中就集成了Spring Web Flow这一Web应用开发利器。下面通过一个实例向大家展示一下在Grails中如何方便的使用Spring Web Flow。
D:_DEVgrails_appsWebFlowDemo>grails create-domain-class User
Welcome to Grails 0.6 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: D:DMY_DEVgrails0.6
Base Directory: D:_DEVgrails_appsWebFlowDemo
Environment set to development
Note: No plugin scripts found
Running script
D:DMY_DEVgrails0.6scriptsCreateDomainClass.groovy
[copy] Copying 1 file to
D:_DEVgrails_appsWebFlowDemograils-appdomain
Created for User
[copy] Copying 1 file to
D:_DEVgrails_appsWebFlowDemo estintegration
Created Tests for User
D:_DEVgrails_appsWebFlowDemo>
4,将grails-appdomainUser.groovy修改为如下内容:
class User implements Serializable {
String username
String password
}
5,“grails generate-all User”,生成所有与域类User相关的目录和文件,输出如下
D:_DEVgrails_appsWebFlowDemo>grails generate-all User
Welcome to Grails 0.6 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: D:DMY_DEVgrails0.6
Base Directory: D:_DEVgrails_appsWebFlowDemo
Environment set to development
Note: No plugin scripts found
Running script
D:DMY_DEVgrails0.6scriptsGenerateAll.groovy
[mkdir] Created dir:
C:Documents and SettingsDaniel.grails.6projectsWebFlowDemoclasses
Compiling 5 source files to
C:Documents and SettingsDaniel.grails.6projectsWebFlowDemoclasses
[mkdir] Created dir:
D:_DEVgrails_appsWebFlowDemoweb-appWEB-INFgrails-appi18n
[copy] Copying 8 files to
D:_DEVgrails_appsWebFlowDemoweb-appWEB-INFgrails-appi18n
[copy] Copying 1 file to
D:_DEVgrails_appsWebFlowDemoweb-appWEB-INFspring
[copy] Copying 1 file to
C:Documents and SettingsDaniel.grails.6projectsWebFlowDemoclasses
[copy] Copying 1 file to
C:Documents and SettingsDaniel.grails.6projectsWebFlowDemoclasses
Generating views for domain class User
Generating controller for domain class User
Finished generation for domain class User
D:_DEVgrails_appsWebFlowDemo>
作者:山风小子 责编:豆豆技术应用