Passing a parameter to <p: commandLink>
2 answers
Replace it with <h:link>
<h:link value="#{user.strUserid}" outcome="test.xhtml"> <f:param name="foo" value="bar" /> </h:link> and use <f:viewParam> to set it as the bean property associated with the landing page
<f:metadata> <f:viewParam name="foo" value="#{bean.foo}" /> </f:metadata> See also:
+7
Then I think you need to try <f:setPropertyActionListener ..
<h:commandButton action="#{testBean.takeParam}" > <f:setPropertyActionListener target="#{testBean.myStringVal}" value="something" /> </h:commandButton> And then you can get this value in your bean class
@SessionScoped public class TestBean{ public String myStringVal; public void setMyStringVal(String myStringVal) { this.myStringVal = myStringVal; } } public void takeParam{ System.out.println("String Value: "+myStringVal); } Also see BalusC JSF Communications
+5