Search code examples
javagrailsnetbeansgsp

MissingMethodException in retrieving passed data through model attribute when rendering template gsp


I just recently started a Grails project in Netbeans. At some point, I need to pass parameters when rendering templates. I've searched here in stackoverflow on how to do that and the result is this code:

<g:render template="/omm/placeOrders/buySellOrders/details/accountDetails" model="[show_sub_fieldset:'false']" />

And on that _accountDetails.gsp file, to fetch that passed value on the model attribute, I used this code on the first line:

<%
  SHOW_SUB_FIELDSET = (${show_sub_fieldset} == true || ${show_sub_fieldset} == 'true');
%>

But I cannot retrieve the passed show_sub_fieldset variable, and instead, receive an error:

URI : /OMM-Revised/placeOrders/buySellOrders
Class : groovy.lang.MissingMethodException
Message : No signature of method:
  C__Users_Gideon_Bardelas_Documents_NetBeansProjects_OMM_Revised_grails_app_views_omm_placeOrders_buySellOrders_details__accountDetails_gsp.$() is applicable for argument types:
    (C__Users_Gideon_Bardelas_Documents_NetBeansProjects_OMM_Revised_grails_app_views_omm_placeOrders_buySellOrders_details__accountDetails_gsp$_run_closure1) values:
    [C__Users_Gideon_Bardelas_Documents_NetBeansProjects_OMM_Revised_grails_app_views_omm_placeOrders_buySellOrders_details__accountDetails_gsp$_run_closure1@62b49424]
  Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;)

Where did I go wrong? Do I need to configure some pages first? Does it have to do with Controllers? Thanks.


Solution

  • It seems removing ${} from ${show_sub_fieldset} works. Is it the proper solution, though?