KickstartWithBootstrap
KickstartWithBootstrap copied to clipboard
_DemoPage does not save in [Grails v. 2.3.5 / KickstartWithBootstrap v. 1.0.0]
Hi, I just tried v. 1.0.0. of the PlugIn with the new Grails v. 2.3.5 and ran into a http 404 and the following stacktrace when trying to save a new item in the demo page:
Method on class [kickstart._DemoPage] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.. Stacktrace follows:
Message: Method on class [kickstart._DemoPage] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
Line | Method
->> 22 | save in kickstart._DemoPageController
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 200 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . in ''
^ 662 | run in java.lang.Thread
Any ideas? Thanks a lot!
my Infrastructure: Windows 8.1 64Bit JDK 1.6.0_25 Grails 2.3.5 Kickstart with Bootstrap 1.0.0 Chrome Version 32.0.1700.76 m
Yes, I have the same problem but I couldn't identify the cause yet. Must be some change from Grails 2.3.x. However, the demopage is not that important and I tested with newly generated Domain Classes in a project and they are working fine (with the exception of the date binding problem)
Servus Jörg, seems like I found a workaround for the date binding problem. Here is what I did:
- installed the jquery-UI plugin
- added the necessary js so my create.gsp looks as follows:
<head>
...
<g:javascript library="jquery" />
<g:javascript>
$(document).ready(function()
{
$("#datepicker").datepicker({dateFormat: 'mm/dd/yyyy'});
})
</g:javascript>
</head>
<body>
...
<g:textField name="someDate" value="${testInstance?.someDate}" id="datepicker" />
...
</body>
- in the controller, I added basically one line in the beginning:
def save() {
params.someDate = params.date( 'someDate', 'mm/dd/yyyy' )
def testInstance = new Test(params)
//println "someDate: ${testInstance.someDate}"
if (!testInstance.save(flush: true)) {
render(view: "create", model: [testInstance: testInstance])
return
}
flash.message = message(code: 'default.created.message', args: [message(code: 'test.label', default: 'Test'), testInstance.id])
redirect(action: "show", id: testInstance.id)
}
I'm sure there is a more elegant way to do this, but this one works for me so far... best regards!