hava一个inputText和一个gmap
<h:inputText class="text" value="#{restaurant.address}" />
<p:gmap id="gmap" center="21.027845,105.852268" zoom="12" type="ROADMAP"
style="width:360px;height:388px"
model="#{restaurant.emptyModel}"
onPointClick="handlePointClick(event);"
widgetVar="map">
首先,address=""
,当我点击gmap时,address="xxx"
不为null。那么如何在点击gmap后在inputText标签中显示其值。谢谢!
答案 0 :(得分:0)
您只需向地图添加ajax事件
即可 <p:gmap id="gmap" center="21.027845,105.852268" zoom="12"
type="ROADMAP" style="width:360px;height:388px"
model="#{restaurant.emptyModel}"
onPointClick="handlePointClick(event);" widgetVar="map">
<p:ajax event="pointSelect" update="theInputText"/>
</p:gmap>
theInputText
将成为要更新的<p:inputText/>
的ID