Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 类:grails.converters.JSON没有这样的属性:propertyId_Javascript_Json_Grails - Fatal编程技术网

Javascript 类:grails.converters.JSON没有这样的属性:propertyId

Javascript 类:grails.converters.JSON没有这样的属性:propertyId,javascript,json,grails,Javascript,Json,Grails,我有一个像这样的grails控制器动作 控制器:Home.groovy 从这个动作中呈现的视图只在下面给出了有错误的部分 查看:Search.gsp 任何帮助都将不胜感激。…为什么要将结果呈现为JSON格式?不要将它们呈现为JSON。您的GSP需要的是映射/模型,而不是JSON结果 从控制器中,按如下方式渲染结果: render(view:'search', model:[ results:results, customerInstance:customerInstance ]) 为什

我有一个像这样的grails控制器动作

控制器:Home.groovy

从这个动作中呈现的视图只在下面给出了有错误的部分

查看:Search.gsp


任何帮助都将不胜感激。…

为什么要将结果呈现为JSON格式?不要将它们呈现为JSON。您的GSP需要的是映射/模型,而不是JSON结果

从控制器中,按如下方式渲染结果:

render(view:'search', model:[
  results:results,
  customerInstance:customerInstance
])

为什么要将结果呈现为JSON格式?不要将它们呈现为JSON。你的GSP期望的是地图/模型而不是JSON结果。thnks@Joshuamore你的想法奏效了为什么@Dónal我知道这可能是个愚蠢的问题,但我是个初学者,非常抱歉
<table style="width: 50%;">
        <g:each in="${results}" var="item">
            <tr>
                <td><div class="box shadow-outside-all" >
                   <input type="checkbox" name="getInterest" id="getInterest"
                    value="${item.propertyId}" style="float: left;" /> 
                    <b> ${item.name?.encodeAsHTML()}</b></br>
                    Property Type: ${item.propertyType?.encodeAsHTML()}</br> 
                    Constructed Size:${item.constructedSize?.encodeAsHTML()}</br> 
                    Land Size: ${item.landSize?.encodeAsHTML()}</br>
                    MRP: ${item.mrp?.encodeAsHTML()}</br> 
                    Location: ${item.location?.encodeAsHTML()}</br>
                   </div>
                </td>
            </tr>
        </g:each>
        <br />

    </table>
No such property: propertyId for class: grails.converters.JSON. Stacktrace follows:
org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [item.propertyId] on line [144]: No such property: propertyId for class: grails.converters.JSON
    at E__Yogesh_development_work_client_okruti_propertyHub_grails_app_views_home_search_gsp$_run_closure2.doCall(search.gsp:144)
    at E__Yogesh_development_work_client_okruti_propertyHub_grails_app_views_home_search_gsp.run(search.gsp:216)
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
    at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49)
    at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: groovy.lang.MissingPropertyException: No such property: propertyId for class: grails.converters.JSON
    at E__Yogesh_development_work_client_okruti_propertyHub_grails_app_views_home_search_gsp$_run_closure2_closure21.doCall(search.gsp:144)
    ... 10 more
render(view:'search', model:[
  results:results,
  customerInstance:customerInstance
])