1

Hi I am using JSF with custom components, I required to perform some logic in back bean(JSF managed bean) after all components is initialized.I tried with @PostConstruct annotation but it will call immediately after constructor. so at that time I was not able to access my components properties as its setter method is not call so far.

Jekin Kalariya
  • 3,475
  • 2
  • 20
  • 32
  • I am talking about setter method of custom components.until setter method was not called by JSF, it will not instantiate my custom component object, so I will not able to set any property of my custom component. – Jekin Kalariya Apr 24 '15 at 10:28
  • Your question is quite vague. Call the method from where? The JSF page? – kolossus Apr 26 '15 at 22:49
  • not from JSF page, want to call method on managed bean after all getter and setter – Jekin Kalariya Apr 27 '15 at 03:42

2 Answers2

1

I think this is where f:viewAction can be used:

<f:metadata>
    <f:viewAction action="#{bean.onload}" />
</f:metadata>

more info

Community
  • 1
  • 1
Ced
  • 15,847
  • 14
  • 87
  • 146
1

If this is pre JSF 2.2 then you have to use

<f:metadata>
  <f:event type="preRenderView" listener="#{myBean.initialize}"/>
</f:metadata>
PDStat
  • 5,513
  • 10
  • 51
  • 86