How to ajax jsf 2 outputLink

前端 未结 1 849
暗喜
暗喜 2021-01-15 16:45

I want to make a webpage that is working on ajax(everything ajax). I mean.. whenever you click a link(I refer to < h:outputLink ...> ) to change a certain div using data

相关标签:
1条回答
  • 2021-01-15 17:23

    <h:link> and <h:outputLink> cannot be ajaxified. All JSF2 ajax requests are per specification POST requests. You need a <h:form> with a <h:commandLink>.

    You could use the following construct:

    <h:form>
        <f:ajax render=":include">
            <h:commandLink value="Home" action="#{menuManager.setPage('home')}" /><br />
            <h:commandLink value="FAQ" action="#{menuManager.setPage('faq')}" /><br />
            <h:commandLink value="Contact" action="#{menuManager.setPage('contact')}" /><br />
        </f:ajax>
    </h:form>
    <h:panelGroup id="include">
        <ui:include src="#{menuManager.page}.xhtml" />
    </h:panelGroup>
    
    0 讨论(0)
提交回复
热议问题