f:ajax not working

后端 未结 2 1945
时光说笑
时光说笑 2021-01-28 18:48

I have trouble getting f:ajax to work on a h:panelGroup. Here\'s what i\'m doing:

JSF code:



        
相关标签:
2条回答
  • 2021-01-28 19:28

    I think the panelGroup will be swallowed since there is only one component inside. Maybe jsf optimizes it.

    Then there is only the h:outputText left and this component doesn't implement the javax.faces.component.behavior.ClientBehaviorHolder interface which is required for a component that gets ajax attached.

    You could use h:outputLink or maybe h:outputLabel instead.

    0 讨论(0)
  • did small POC for ajax may be useful for others

    This chunk will show that we can call managed bean method and Ajax together and it works using JSF2.0

    <h:form>     
      <h:inputText id="comments" value="#{photoManagedBean.name}"></h:inputText>
    
      <h:commandButton value="Comments Input" >
        <f:ajax execute="comments" listener="#{photoManagedBean.saveComments()}" render="displayRecentComments" />
    
       </h:commandButton>
       <br/>
    
       <table width="600" border="0"  height="80">
         <td>
           <h:outputText id="displayRecentComments" value="#{photoManagedBean.name}"/>
         </td>
       </table>
     </h:form>
    

    ManagedBean:

    public void saveComments() { //ur code//}
    
    0 讨论(0)
提交回复
热议问题