2013-05-03 3 views
-1

Я хочу открыть GMAP внутри моей страницы JSF, я попробовал эти образцы, но это не сработало:primefaces GMmap внутри диалог не оказывающего

<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> 

ответ

0

Ваша ошибка состоит: в композиции, вы должны включить <h:head></h:head>, чтобы применить css, но любой код из него не был загружен. Вы должны добавить сценарий к /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> 

Смотри также: understand the purpose of jsf ui:composition

Смежные вопросы