How to use Ajax with JSF 2.0?

后端 未结 4 1245
名媛妹妹
名媛妹妹 2020-12-22 05:41

I want to implement Ajax on my JSF web project. I googled and found that ICEFaces is supporting Ajax with JSF. Yet I dont know the usability of it.

Any one has exper

相关标签:
4条回答
  • 2020-12-22 05:47

    It is quite simple and elegant to use Ajax in JSF but you should not abuse because of debugging constraints.

    HTML page Fragment :

     <h:commandLink  value="tab 1">
        <f:param name="tabIndex" value="1" />
        <f:ajax event="click" render=":contentForm" listener="#{tabBB.handleTabChange}"/>
     </h:commandLink>
    

    Backing bean fragment :

    public boolean handleTabChange() {
        ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
        String index = externalContext.getRequestParameterMap().get("tabIndex");
        setTabIndex(Integer.parseInt(index));
        return true;
    }
    
    0 讨论(0)
  • 2020-12-22 05:53

    I'd like to suggest - Pro JSF and Ajax: Building Rich Internet Components

    0 讨论(0)
  • 2020-12-22 05:57

    JSF 2.0 has built in basic AJAX functionality through the f:ajax tag.

    David Geary shows how in part 3 of his jsf-fu articles. http://www.ibm.com/developerworks/java/library/j-jsf2fu3/index.html

    0 讨论(0)
  • 2020-12-22 06:03

    JSF 2.0 has built-in support for Ajax using the f:ajax tag. All three of ICEFaces, OpenFaces, and RichFaces also have Ajax-enabled components but with JSF 2.0 it is now possible to add Ajax to your apps without using third-party libraries. IBM has a series of nice tutorials in this regards: http://www.ibm.com/developerworks/views/java/libraryview.jsp?search_by=JSF+2+fu

    0 讨论(0)
提交回复
热议问题