DefaultMenuItem setParam

UI Components for JSF
Post Reply
lgklein
Posts: 24
Joined: 19 Oct 2013, 16:19

21 Aug 2014, 12:44

Hello guys,

sorry for bad engl~

Primefaces: 5.0
JSF 2.1.26
Mojarra 2
Jboss 6


My doubt is how to get the value of a parameter sent by a menu created in the bean?
I know it's a very beginner question, but the google search and the forum only shows how to send the parameter rather than receive...

Xhtml:

Code: Select all

<p:menubar id="menu" model="#{cabecalhoBean.menuModel}" styleClass="NG_Menu" />
Create Menu:

Code: Select all

final DefaultMenuItem item = new DefaultMenuItem(((MenuElement) menu).getLabel());
item.setUrl(((MenuElement) menu).getComando());
item.setParam("teste", "teste1");
What I try in Bean:

Code: Select all

@ViewScoped
@ManagedBean
public class CestaDfuBean {

    private String teste;

    @PostConstruct
     public void init() {
         //This is moment when I need have paramValue, in this moment
         //global variable is null and code below too...
         FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("teste"); 
     }
 
    public String getTeste() {
          return teste;
    }

    public void setTeste(final String teste) {
	  this.teste = teste;
    }
}
Primefaces: 5.0
JSF 2.1.26
Mojarra 2
Jboss 6

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests