binding - JSF 1.x ValueBinding is deprecated, what is the correct replacement? -
i have jsf 1.0/1.1 code:
facescontext context = facescontext.getcurrentinstance(); valuebinding vb = context.getapplication().createvaluebinding("#{somebean}"); somebean sb = (somebean) vb.getvalue(context);
since jsf 1.2, valuebinding
deprecated , replaced valueexpression
. i'm not sure how change above code in order use valueexpression
.
the part
valuebinding vb = context.getapplication().createvaluebinding("#{somebean}"); somebean sb = (somebean) vb.getvalue(context);
should replaced by
valueexpression ve = context.getapplication().getexpressionfactory().createvalueexpression(context.getelcontext(), "#{somebean}", somebean.class); somebean sb = (somebean) ve.getvalue(context.getelcontext());
or, better
somebean bc = context.getapplication().evaluateexpressionget(context, "#{somebean}", somebean.class);
Comments
Post a Comment