f:ajax 与 h:commandButton 使用备忘(真要好好看看书了)

来源:互联网 发布:邵阳网络推广 编辑:程序博客网 时间:2024/04/30 07:34
<h:panelGrid columns="3">            <h:commandButton value="salut" actionListener="#{greetingController.saySalut}">    <f:ajax render="@form" event="click" />  </h:commandButton>  <!-- 上面这种写法是无法正常运行的。-->  <!-- f:ajax会异步获取message的当前值,但是h:commandButton的actionListener却没有机会执行。应该去掉f:ajax event="*" -->  <!-- 正解是下面这一段代码 -->  <h:commandButton value="hello" actionListener="#{greetingController.sayHello}">    <f:ajax render="message" />  </h:commandButton></h:panelGrid><h:panelGrid>  <h:outputText id="message" value="#{greetingController.message}" /></h:panelGrid>