How to refresh page in JSF on selectOneMenu selection?

前端 未结 2 1599
臣服心动
臣服心动 2021-01-06 17:52

I have a page containing a PrimeFaces (2.2.1) Editor component, a Refresh button and a selectOneMenu, whose selection affects the contents of the Editor, as follows:

相关标签:
2条回答
  • 2021-01-06 18:31

    please try the onchange="window.location.reload();" approach like:

    <h:selectOneMenu id="skipLines" ... onchange="window.location.reload();">
        <f:selectItems ... />
        <f:ajax ... />
    </h:selectOneMenu>
    

    This works just fine in my environment (GF 3.1.1, PF 3.2) but please be aware that there is the possibility of interrupting some ajax functinality.

    Hope this helpes, have Fun!

    0 讨论(0)
  • 2021-01-06 18:33

    Invoke window.location.replace(window.location.href) rather than submit() in the onchange event, as in:

    <h:selectOneMenu id="skipLines" ... onchange="window.location.replace(window.location.href);">
        <f:selectItems ... />
        <f:ajax ... />
    </h:selectOneMenu>
    
    0 讨论(0)
提交回复
热议问题