This is one of the things you have to change when migrating your JSF-Spring application from JSF 1.x to JSF 2.
In JSF 1.x, to get access to a spring bean in a backing bean or in a converter, you would do:
FacesContext context = FacesContext.getCurrentInstance();
MyService myService = (MyService) context.getApplication().createValueBinding("#myService}").getValue(context);
In JSF 2 this is replaced by:
FacesContext context = FacesContext.getCurrentInstance();
MyService myService = (MyService) context.getELContext().getELResolver().getValue(context.getELContext(), null, "myService");
Another way to do it would be:
FacesContext context = FacesContext.getCurrentInstance();
String remoteUser = context.getApplication().evaluateExpressionGet(context, "#myService.currentUser}", String.class);
nice, thanks
ReplyDeletehttps://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
TQD7K
I find the explanation of how accessing Spring beans differs between JSF 1.x and JSF 2 very helpful.
ReplyDelete