扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:山风小子 来源:蛟龍居 2007年11月18日
关键字:
在本页阅读全文(共4页)
ok.gsp:
9,修改demo\grails-app\conf\ApplicationBootStrap.groovy,将一个User实例保存到数据库(grails自带hsqldb和jetty)中,内容如下:
class ApplicationBootStrap { def init = { servletContext -> new User(name: "demo", password: "123456").save() } def destroy = { } } |
10,在“命令行”中,输入“grails run-app”,运行我们的Web应用,输出如下:
D:\Temp\grails_apps\demo>grails run-app Welcome to Grails 0.4.2 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: D:\D\MY_DEV\grails Base Directory: D:\Temp\grails_apps\demo Environment set to development Running script D:\D\MY_DEV\grails\scripts\RunApp.groovy Compiling sources [delete] Deleting directory D:\Temp\grails_apps\demo\web-app\WEB-INF\grails-a pp [mkdir] Created dir: D:\Temp\grails_apps\demo\web-app\WEB-INF\grails-app\vie ws [mkdir] Created dir: D:\Temp\grails_apps\demo\web-app\WEB-INF\grails-app\i18 n [copy] Copying 8 files to D:\Temp\grails_apps\demo\web-app\WEB-INF\grails-a pp\views [native2ascii] Converting 1 file from D:\Temp\grails_apps\demo\grails-app\i18n t o D:\Temp\grails_apps\demo\web-app\WEB-INF\grails-app\i18n Attempting to load [13] core plugins Grails plug-in [i18n] with version [0.4.2] loaded successfully Grails plug-in [quartz] with version [0.4.2] loaded successfully Grails plug-in [core] with version [0.4.2] loaded successfully Grails plug-in [domainClass] with version [0.4.2] loaded successfully Grails plug-in [controllers] with version [0.4.2] loaded successfully Attempting to load [0] user defined plugins Grails plug-in [dataSource] with version [0.4.2] loaded successfully Grails plug-in [codecs] with version [0.4.2] loaded successfully Grails plug-in [hibernate] with version [0.4.2] loaded successfully Grails plug-in [services] with version [0.4.2] loaded successfully Grails plug-in [scaffolding] with version [0.4.2] loaded successfully [RuntimeConfiguration] Configuring for environment: Development Building new Hibernate SessionFactory Neither 'urlMap' nor 'mappings' set on SimpleUrlHandlerMapping 64 beans defined in application context [org.codehaus.groovy.grails.commons.spri ng.GrailsWebApplicationContext;hashCode=6971605] Using MessageSource [org.springframework.context.support.ReloadableResourceBundl eMessageSource: basenames=[WEB-INF/grails-app/i18n/messages]] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticas ter': using default [org.springframework.context.event.SimpleApplicationEventMul ticaster@181d405] [copy] Copying 8 files to D:\Temp\grails_apps\demo\web-app\WEB-INF\grails-a pp\views [GrailsContextLoader] Grails application loaded. Initializing filter 'grailsWebRequest' Filter 'grailsWebRequest' configured successfully Initializing filter 'reloadFilter' Filter 'reloadFilter' configured successfully Initializing servlet 'grails' FrameworkServlet 'grails': initialization started Using context class [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicat ionContext] for servlet 'grails' Using MultipartResolver [org.springframework.web.multipart.commons.CommonsMultip artResolver@1945696] Using LocaleResolver [org.springframework.web.servlet.i18n.CookieLocaleResolver@ 1c0bec5] Unable to locate ThemeResolver with name 'themeResolver': using default [org.spr ingframework.web.servlet.theme.FixedThemeResolver@1984161] No HandlerAdapters found in servlet 'grails': using default Unable to locate RequestToViewNameTranslator with name 'viewNameTranslator': usi ng default [org.springframework.web.servlet.view.DefaultRequestToViewNameTransla tor@688d6f] FrameworkServlet 'grails': initialization completed in 187 ms Servlet 'grails' configured successfully |
11,打开浏览器,输入:http://localhost:8080/demo/login/login ,在Name处输入demo,Password处输入123456,点击‘Login’,跳转到成功页面:
Welcome demo demo : 123456 |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者