views:

205

answers:

1

Hi all,

I having trouble with passing http get parameters to jsf 2.0 backing bean. User will invoke URl with some params containing id of some entity, which is later used to persist some other entity in db.

whole process can be summarized by fallowing: 1. user open page http://www.somhost.com/JsfApp/step-one.xhtml?sid=1 2. user fills some data and goes to next page 3. user fills some more data and then entity is saved to db with sid param from step one.

I have session scoped backing bean that hold data from all the pages (steps), but I cant pass param to bean property..

any ideas?

+1  A: 

That's only possible if the bean is request scoped since it's a request parameter. Create a request scoped bean and make the current session scoped bean a managed property of it as well.

@ManagedBean
@RequestScoped
public class Step {

    @ManagedProperty(value="#{param.sid}")
    private Long sid;

    @ManagedProperty(value="#{data}")
    private Data data; // #{data} is a @SessionScoped @ManagedBean

    public String submitStep1() {
        // ...
    }

    public String submitStep2() {
        // ...
    }

    // ...
}
BalusC