简体   繁体   中英

Grails: use of <g:select>

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 some 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;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM