jsf - Cache ValueExpression instances -
i've written application in jsf generates crud pages based on configuration files. configure pages possible provide parameters. can of type , el expressions. create , evaluate these expressions each getter-invocation, not ideal solution, think:
now have 2 simple questions can't answer myself:
it should possible cache valueexpression instances per request. on first access (in case use jsf's
postaddtoview
event) create expression , evaluate in in each getter-invokation.public void populatecomponent(componentsystemevent event) { facescontext context = facescontext.getcurrentcontext(); _valueexpression = context.getapplication().getexpressionfactory() .createvalueexpression(context.getelcontext(), _expression, string.class); } public string getexpressionvalue() { facescontext context = facescontext.getcurrentcontext(); return (string) _valueexpression.getvalue(context.getelcontext()) }
this should same using expression directly in xhtml processed jsf itself. any problems solution don't see @ moment?
is possible create instance of valueexpression once , use request? cache on application level instead of per request. removes
postaddtoview
event , moves logic configuration parser (which has access facescontext). or may hit side effects when single value expression used in multiple requests/threads?
Comments
Post a Comment