如何在jsf中获取其他事件后的输入值?

时间:2013-10-06 19:00:57

标签: ajax jsf

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标签中显示其值。谢谢!

1 个答案:

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