2

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.

Matt Handy
  • 29,855
  • 2
  • 89
  • 112
Achraf
  • 658
  • 6
  • 14
  • 34

1 Answers1

3

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;

// ...
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • when I test with ViewScope for both bean, I get `The scope of the object referenced by expression #{param.resvDataModel}, request, is shorter than the referring managed beans (ReservationActionBean) scope of view`. What I need to do? – Zaw Than oo Oct 11 '12 at 06:09
  • @Cyc: use ``. See also http://stackoverflow.com/questions/4888942/viewparam-vs-managedpropertyvalue-param-id – BalusC Oct 11 '12 at 10:47