Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.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
点击谷歌地图中的图标后在jsf中渲染面板_Jsf_Panel_Render - Fatal编程技术网

点击谷歌地图中的图标后在jsf中渲染面板

点击谷歌地图中的图标后在jsf中渲染面板,jsf,panel,render,Jsf,Panel,Render,我正在jsf页面中使用gopogle映射。在使用google地图之前,我已按以下方式指定图标值: <a4j:commandLink render="assetSummaryMainPanel" status="nameStatus"> <h:graphicImage

我正在jsf页面中使用gopogle映射。在使用google地图之前,我已按以下方式指定图标值:

<a4j:commandLink render="assetSummaryMainPanel"
                                        status="nameStatus">
                                        <h:graphicImage
                                            url="#{appPath}/images/stock/#{childAsset.assetIconImageName}"
                                            title="#{childAsset.name}" alt="#{childAsset.name}"
                                            style="position:absolute;left:#{childAsset.modImageCoordinateX}px;top:#{childAsset.modImageCoordinateY}px;border:none;" />

                                        <a4j:param name="selectedSensor"
                                            value="#{childAsset.coModAssetId}"
                                            assignTo="#{AssetSummaryPageModel.selectedSensorId}" />
                                        </a4j:commandLink>

但我需要使用谷歌地图,还需要如上所述分配值,以便它可以从谷歌地图图标渲染面板。我使用谷歌地图如下,但我不能分配第一个commandLink中的值。我该怎么做呢

<div id="imageMap" style="width:270px; height:350px;"></div>
       <script type="text/javascript">  
            var mapLocations = [[]];
            var centerMapLan = 0.0;
            var centerMapLong = 0.0;
       </script>

       <c:forEach items="#{asset.companyModuleAssets}" var="childAsset" varStatus="status">
           <script type="text/javascript">  
                mapLocations[#{status.index}] = ["#{appPath}/images/stock/#{childAsset.assetIconImageName}", "#{childAsset.name}", new google.maps.LatLng(#{childAsset.location.x}, #{childAsset.location.y}), #{childAsset.location.x}, #{childAsset.location.y}];
                centerMapLan = centerMapLan + #{childAsset.location.x};
                centerMapLong = centerMapLong + #{childAsset.location.y};

           </script> 


        </c:forEach>


        <script type="text/javascript"> 
           //  <![CDATA[
            $(document).ready(function() {
                // execute
                (function() {
                    // map options
                    var options = {
                        zoom: 18,
                        center: new google.maps.LatLng(centerMapLan/mapLocations.length, centerMapLong/mapLocations.length), // centered US
                        mapTypeId: google.maps.MapTypeId.SATELLITE,
                        mapTypeControl: false
                    };

                    // init map
                    var map = new google.maps.Map(document.getElementById('imageMap'), options);

                 // set multiple marker
                    for (var i = 0; i < mapLocations.length; i++) {
                        // init markers
                        var marker = new google.maps.Marker({
                            position: mapLocations[i][2],
                            map: map,
                            icon: mapLocations[i][0],
                            title: mapLocations[i][1]
                        });

                        // process multiple info windows
                        (function(marker, i) {
                            // add click event
                             google.maps.event.addListener(marker, 'click', function() {
                                infowindow = new google.maps.InfoWindow({
                                    content: mapLocations[i][1]
                                });
                                infowindow.open(map, marker);
                            }); 
                        })(marker, i);
                    }
                })();
            });
            //   ]]>    
            </script>

var mapLocations=[[]];
var centerMapLan=0.0;
var centerMapLong=0.0;
mapLocations[#{status.index}]=[“#{appPath}/images/stock/#{childAsset.assetIconImageName}”,“#{childAsset.name}”,新的google.maps.LatLng(#{childAsset.location.x},#{childAsset.location.y}),#{childAsset.location.x},#{childAsset.location.y},#;
centerMapLan=centerMapLan+#{childAsset.location.x};
centerMapLong=centerMapLong+#{childAsset.location.y};
//      

请提供任何帮助。

解决方案是,我们需要在Listener下调用一个方法,并将相应的图标id传递给该方法,然后在
中使用a4j:param。这应该有效。:-)