Jsf 在<;中传递参数;p:commandLink>;
嗨,我有一个类似这样的代码:Jsf 在<;中传递参数;p:commandLink>;,jsf,primefaces,Jsf,Primefaces,嗨,我有一个类似这样的代码: <p:commandLink value="#{user.strUserid}" action="test.xhtml?faces-redirect=true"/> 如何将参数传递给test.xhtml以获取所述页面中的值? 我尝试使用标记。但是可以在test.xhtml页面中获取值。 请建议。那么我认为您需要尝试用替换它 并使用将其设置为与目标页面关联的bean的属性 <f:metadata> <f:viewPara
<p:commandLink value="#{user.strUserid}" action="test.xhtml?faces-redirect=true"/>
如何将参数传递给test.xhtml以获取所述页面中的值?
我尝试使用
标记。但是可以在test.xhtml
页面中获取值。
请建议。那么我认为您需要尝试用
替换它
并使用
将其设置为与目标页面关联的bean的属性
<f:metadata>
<f:viewParam name="foo" value="#{bean.foo}" />
</f:metadata>
另见:
您可以添加更多详细信息吗?但可以在test.xhtml页面中获取值
。。。这是什么意思?OP使用的是JSF2。这篇文章的目标是JSF1。有一个JSF2变体:
@SessionScoped
public class TestBean{
public String myStringVal;
public void setMyStringVal(String myStringVal) {
this.myStringVal = myStringVal;
}
}
public void takeParam{
System.out.println("String Value: "+myStringVal);
}
<h:link value="#{user.strUserid}" outcome="test.xhtml">
<f:param name="foo" value="bar" />
</h:link>
<f:metadata>
<f:viewParam name="foo" value="#{bean.foo}" />
</f:metadata>