You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Ricardo R. Ramírez Valenzuela" <rr...@itesm.mx> on 2005/06/08 16:18:58 UTC

Cannot restore component state, what to do in this case?

I have a weird scenario I've been unable to solve, I wonder if you have 
any ideas.
All the beans are request, I'm trying to avoid session beans for now

1) I have page1Customers, with a list of customers:
    customer1 [edit]
    customer 2 [edit]

2) when I click on "edit" I get the "page2Products" bean via 
valuebinding and call it's setCustomer() property, so the page2 knows 
which customer I'm talking about

3) In that "page2Products" I print
    product1 [edit]
    product2 [edit]
    product3 [edit]

And if I click on edit I'd go to see the product detail.

However, this doesn't work. The reason? Since it is a request bean then 
after the page is submitted:

4) Page2Products.getProductList() is called, but since the customer 
hasn't been set it can't return the list of products for that customer, 
I can't restore the component state without the customer data, since the 
products depend on the customer
5) Since the datatable couldn't be restored the onClick action in 
productXX is never called
6) After that, setCustomer is called, and then getProductList() again to 
render the datatable, and I end up in the same page since the onClick 
was never called

Any suggestions? I think I've reached a dead-end

I was trying to avoid using session beans because that gives me a lot of 
trouble when the user is browsing the application in 2-3 windows at once.

-Ricardo Ramírez