Passing parameters between managed beans with request scope

二次信任 提交于 2019-12-28 06:26:27

问题


Im working on a web application using JSF2. I want to pass parameters from a managed bean in backing bean action and I want to retrive the same parametrs in an other managed bean the both with a request scope.

Thanks in advance.


回答1:


Use <f:param> in the command link/button and use @ManagedProperty or <f:viewParam> in the target bean or view.

E.g.

<h:commandButton value="Submit" action="#{otherBean.submit}">
    <f:param name="foo" value="#{oneBean.foo}" />
</h:commandButton>

with in OtherBean

@ManagedProperty("#{param.foo}")
private String foo;

// ...


来源:https://stackoverflow.com/questions/9701590/passing-parameters-between-managed-beans-with-request-scope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!