Search code examples
jqueryajaxjsfmanaged-bean

Using jquery ajax to call a jsf managed bean method (an AjaxBehaviorEvent listener handler)


i would like to know if there is a way to fire a jsf managed bean method (with an AjaxBehaviorEvent type parameter: the same triggered when using f:ajax) directly by using a jquery ajax server request.By the way , i m a jsf developper and i didn't find an example about using jquery ajax with Java EE as a server-side framework, all examples i found were with php..so i wish to get a complete example about doing that. i think the other workaround maybe is to make a commandLink being submitted with jquery on the client side and passing parameters through that call but i prefer the former solution and i wish it work.

Thanks very much for help !


Solution

  • Here you go:

    <script type="text/javascript">
    
        doAwesomeness();
    
    </script>
    

    In your page:

    <a4j:jsFunction name="doAwesomeness" action="#{awesomeBean.awesomeMethod}"/>
    

    Good luck!