primefaces GMmap里面没有渲染的对话框 [英] primefaces GMmap inside a dialog not rendering

查看:102
本文介绍了primefaces GMmap里面没有渲染的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < p>< p>< p>< ; html xmlns =http://www.w3.org/1999/xhtml
xmlns:ui =http://java.sun.com/jsf/facelets
xmlns:h = http://java.sun.com/jsf/html
xmlns:f =http://java.sun.com/jsf/core
xmlns:p =http:/ /primefaces.org/ui\">
< h:头>
< script src =http://maps.google.com/maps/api/js?sensor=false
type =text / javascript>< / script>
< / h:头>
< body>
< ui:composition template =/ WEB-INF / template / template.xhtml>
< ui:define name =content>
onclick =dlg.show()/>

< p:dialog widgetVar =dlgwidth =625height =400modal =true>
style =width:600px; height:400pxwidgetVar =mymap/>
< / p:对话框>
< / ui:define>
< / ui:composition>
< / body>
< / html>


解决方案

您的错误在于: < h:head>< / h:head> 来应用css,但是没有加载任何代码。您需要将脚本添加到 /WEB-INF/template/template.xhtml



template.xhtml

 < h:head> 
//其他地方
< script src =http://maps.google.com/maps/api/js?sensor=false
type =text / javascript> ;< /脚本>
< / h:头>

另请参阅


I want to open a Gmap inside my jsf page, i tried these sample but it didn't work:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<script src="http://maps.google.com/maps/api/js?sensor=false"
    type="text/javascript"></script>
</h:head>
<body>
<ui:composition template="/WEB-INF/template/template.xhtml">
    <ui:define name="content">
        <p:commandButton type="button" icon="ui-icon-pin-s" value="Show Map"
            onclick="dlg.show()" />

        <p:dialog widgetVar="dlg" width="625" height="400" modal="true">
            <p:gmap center="41.381542, 2.122893" zoom="15" type="HYBRID"
                style="width:600px;height:400px" widgetVar="mymap" />
        </p:dialog>
    </ui:define>
</ui:composition>
</body>
</html>

解决方案

Your mistake is: in composition, you have to include <h:head></h:head> to apply css, but any code from that have not been loaded. You need to add script to /WEB-INF/template/template.xhtml

template.xhtml:

<h:head>
    // other here
    <script src="http://maps.google.com/maps/api/js?sensor=false"
    type="text/javascript"></script>
</h:head>

See also:understand the purpose of jsf ui:composition

这篇关于primefaces GMmap里面没有渲染的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆