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:

  1. 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?

  2. 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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -