Our problem is a very basic, simple implementation of editing the database using JSF + EJB.
Keeping things short: two separate XHTML views, use two separate Managed Beans @RequestScope.
WebuserListBean and EditWebuserBean, and with @ManagedProperty we inject WebuserListBean, so we could obtain selected user data. So far no problems. Views are filled with data succesfully!
BUT! We want to be able to edit the user! And here (to my surprise) we cannot overcome the problem.
1st try: Because the request scoped bean is dead after filling the view, on Save() method the @PostConstruct tries to launch again, of course it can't. So we couldn't even obtain it from database or anything.
2nd try: Because the request scoped bean is dead after filling the view, if we do not set up user as field in @postconstruct, we lose our connection with user object which was linked on previous view (and injected, but now that view is dead too).
3rd try: Cannot inject RequestScope in ViewScoped
Ok and our restrictions, because we think it's wrong way:
- We dont want to create a SessionScoped Managed Bean for this
- We dont want to use any params etc. We want to use EJB
- We are not sure if we could store data in Stateful session bean which is our endpoint for the module? Is it proper approach?
Thanks for any advice, we could paste some code but i guess it is pointless! Cheers!