I try to get a parameter from the URL but I can't. I do this in my jsf
<f:metadata>
<f:viewParam name="key" value="#{confirmationMB.key}" required="true" />
<f:viewAction action="#{confirmationMB.confirmer()}"/>
</f:metadata>
and this in my managed bean :
@ManagedBean
@ViewScoped
public class confirmationMB {
private String key; public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public void confirmer(){
System.out.println("the key is "+key);
}
my URL is like this:
http://localhost:8080/exempler/validate_inscription.xhtml?key=124he
I get always null as value in System.out..can someone help me please ?
Edit:
when I try <h:outputText value="#{param['key']}" /> in xhtml I can get the key but I don't know how I can insert it into my Bean !!