JSF/PrimeFaces selectOneMenu change view-id

前端 未结 3 985
萌比男神i
萌比男神i 2021-02-03 16:05

I\'m using JSF2 and PrimeFaces3. How can I write selectOneMenu that would invoke JSF navigation to redirect user to another page when he change option in menu?

3条回答
  •  别跟我提以往
    2021-02-03 16:31

    You could have something like:

    
               
               
               
               
     
    

    and on your navigationMethod you have:

    String myPage = mySelectedPage
    FacesContext.getCurrentInstance().getExternalContext().redirect(myPage);
    

    The first two selectItem are for a full url and the last one is for another page in your web application(be careful that the extension must be the one set in your web.xml - it could be .jsf, .xhtml, .htm etc)

提交回复
热议问题