开发者

Grails: use of <g:select>

开发者 https://www.devze.com 2023-03-28 10:53 出处:网络
I am stuck on something which seems really simple, but apparently is not :) Thanks in advances for any help, any attempt of solution is most welcomed.

I am stuck on something which seems really simple, but apparently is not :) Thanks in advances for any help, any attempt of solution is most welcomed.

My problem is the following: My .gsp view:

<td> 
   <g:select from="${creditProviders}"/>    
</td>

My .groovy controller method:

def simulate = {// Need to provide the list of credit providers 
        def creditProviders = CreditProvider.findAll()
        [ creditProviders : creditProviders ]
 }

The error I get:

Error processing GroovyPageView: Error executing tag <g:select>: null at /pathTo the view

So I do not manage to populate my tag for so开发者_如何学Pythonme reason... I can call my ${creditProviders} variable outside the tag and it works like a charm. I am stuck, and do not understand what is wrong.

Wish you a good day :)


Your <g:select> probably needs a name attribute. Try:

<g:select name="something" from="${creditProviders}"/>


Unfortunately you have been runnning into a known issue in grails 1.3.7. You need to define the name-tag. If you don't, you get this meaningless NPE. This bug is fixed in grails 2.0 ( http://jira.grails.org/browse/GRAILS-7656 ).

Good luck ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号