This discussion is archived
1 Reply Latest reply: Aug 2, 2012 1:13 AM by r035198x RSS

how updating the content of a  jsf ui using actionListner of a button?

REDO LOG Newbie
Currently Being Moderated
Hi all

I am seeking to update then content of a div in jsf using a java class MenuContent (Managed bean + session scope)



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package beans;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
*
* @author ouboujlal
*/
@ManagedBean
@SessionScoped
public class MenuContent {
private static String page;

public String getPage() {
return page;
}

public void setPage(String page) {
this.page = page;
}


public MenuContent(){
page = "personnelPage";
}
}



ans in the button:

<h:commandButton value="Test" actionListener="#{menuContent.setPage('ListGuests')}" />





then I include the UI in my xhtml page:

....
<body>
<ui:include src = "./pages/#{menuContent.page}.xhtml" />

</body>
..



the problem is that the page doesn't change(because the attribute page in the MenuContent class doesn't )

is there any annotation I have to add or chage the make that attribute change? because I really don't know why it still the seem


thanks for help

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points