0

I have a JSF Composite Component which is loading its own Data in Contractor method. Data is loading from webservice. Now I want to add some filter attrbutes for passing to the web service. But I can't access to the attributed in contactor method. So what shlould do ?
My Components XML

<cc:interface componentType="AccountComponent">
     <cc:attribute name="value" type="com.test.pojo.Account"  shortDescription="Account Class" />  
        <cc:attribute name="CurrencyCode"  />
    </cc:interface>

And my Backing Bean .

   // Constactor MEthod.
    public AccountComponent(){      
            String attr=this.getAttributeValue("CurrencyCode", null); // I can not access attribute here. It is allways null
            AccountComponentLoadDataFromService(attr);

        }

So what I want to know if is there any other phase or method two load data and access to attributes at same time ?

By the way , my helper method that uses to get attribute is below.

private <T> T getAttributeValue(String key, T defaultValue) {
        T value = (T) getAttributes().get(key);
        return (value != null) ? value : defaultValue;
    }
ilhan
  • 113
  • 1
  • 13
  • Hi @BalusC I've tried it, it's OK in first page load but it doesn't work after posback because the event doesn't run so there is no items in the array. and an other questions is do I need to reload data after posback? – ilhan Jun 01 '17 at 15:36
  • Maybe I should keep my data in viewstate Is it make sense to do this? – ilhan Jun 01 '17 at 16:14
  • Hi again, postAddToView event works very well. Thanks so much @BalusC – ilhan Jun 04 '17 at 05:55

0 Answers0