Yannick Le Teigner wrote:
Simon, Mike,
Thanks for the explanation.
I was able to make it work by using below code:
FacesContext ctx = FacesContext.getCurrentInstance();
ValueBinding binding = ctx.getApplication().createValueBinding("#{User}");
binding.setValue(ctx, new User(id));
Trying to put the User bean in the request map was apparently the wrong
way of doing it:
ctx.getExternalContext().getRequestMap().put("#{User}", new User(id));
Just FYI, using
getRequestMap().put("User", new User(id));
should be the same as the above code. The expression evaluator simply
looks in request, session and application scopes for an entry of the
specified name. If not found, then it looks for a managed bean
declaration and instantiates as described earlier.
However as long as you've got something working, that's the important
bit :-).
Cheers,
Simon