Abdelhak Bouguila
Abdelhak Bouguila

Reputation: 1

how can i pass an url parameter between two xhtml pages?

i am trying to pass a parameter between two pages

in the bean i have this string with getters and setters outcome is the function to run with the button

@Named("MeubleBean")
@ManagedBean 
@SessionScoped 
@RequestScoped
public class MeubleBean implements Serializable {
 private String param1;

 public String outcome() {

FacesContext fc = FacesContext.getCurrentInstance();
Map<String, String> params = fc.getExternalContext().getRequestParameterMap();
param1 = params.get("param1Name");


return "meubles3.jsf?faces-redirect=true&includeViewParams=true";
}
}

the code of the command button in the page meubles.xhtml :

         <f:param id="param1" name="param1Name" value="param1Value"/>
            </h:commandButton>

and finally the output in meubles3.xhtml :

<h:form><h:outputText value="#{meubleBean.param1}"></h:outputText>
</h:form>

i am trying the "param1value" as test value . the output is always empty, i tried several ways none of em worked. any solution please ???

Upvotes: 0

Views: 170

Answers (0)

Related Questions