首页 > 解决方案 > p:gmap 不在 ah:form 标签内渲染

问题描述

添加标签时地图未呈现。当我删除标签时,地图会呈现。请协助。

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui">

<h:head>
    <title></title>
    <h:outputStylesheet library="css" name="base.css" />
</h:head>
<h:body>
    <h:form>
        <p:gmap
            center="#{initParam['centerLatitude']}, #{initParam['centerLongitude']}"
            zoom="#{initParam['centerZoom']}" type="map"
            style="width:100%;height:100%" model="#{mapBean.mapModel}">
            <p:ajax listener="#{mapBean.onMarkerSelect}" event="overlaySelect" />
        </p:gmap>
    </h:form>
    <script
        src="https://maps.googleapis.com/maps/api/js?key=#{initParam['googleApiKey']}&amp;callback=initMap"></script>
</h:body>
</html>

标签: jsfprimefaces

解决方案


当我从样式标签中的 100% 高度更改为 600px 时,地图再次显示。问题似乎与 100% 高度有关。


推荐阅读