Announcement Announcement Module
Collapse
No announcement yet.
how to see a list variable, created in config.groovy, in GSP View page? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to see a list variable, created in config.groovy, in GSP View page?

    I wanted to use a configurable list of select options for my create.gsp as follows:

    1) in Config.groovy:
    catagory_list = ["Wedding", "Birthdays", "Celebrations", "Cupcakes"]

    2) Then I created a tagLib to create this variable like this:
    class GlobalVarsTagLib {
    def catagoryOptions = {

    out << grailsApplication.config.catagory_list
    }
    }

    3) Then I tried to access this catagoryOptions list from my create.gsp as follows:
    <%@ page import= "marlborocakes.GlobalVarsTagLib" %>
    <g:select name="catagory" from="${GlobalVarsTagLib.catagoryOptions()}" ></g:select>

    I am getting error as follows:
    Caused by: Error processing GroovyPageView: Error executing tag <g:form>: Error evaluating expression [GlobalVarsTagLib.catagoryOptions()] on line [45]: groovy.lang.MissingMethodException: No signature of method: static marlborocakes.GlobalVarsTagLib.catagoryOptions() is applicable for argument types: () values: [] Possible solutions: getCatagoryOptions(), setCatagoryOptions(java.lang.Object) at /Users/sankumanis/Documents/workspace-sts-2.8.1.RELEASE/MarlboroCakes/grails-app/views/design/create.gsp:75
Working...
X