0

I am wondering how should I call a bean method after page loading. I tried something like this but it did not actually work:

            <p:remoteCommand name="autoRun"
                             action="#{enbBean.getFakeEndListForTesting()}"
                             autoRun="true" update="enbTable"/>

3 Answers3

1

Strange, that should work. Any exceptions? This post contains some alternative ways of achieving what you need. The most standard way should be the first suggestion, to use

<h:body>
    <f:ajax event="load" listener="#{bean.onload}" />
</h:body>

with this

public void onload(AjaxBehaviourEvent event) {
    // ...
}
Community
  • 1
  • 1
Predrag Maric
  • 23,938
  • 5
  • 52
  • 68
0

You can use @PostConstruct annotation for this method.

user3655551
  • 111
  • 1
  • 4
0

below link visit. as far as i know xhtml page loading event run !!!

When to use f:viewAction / preRenderView versus PostConstruct?

Community
  • 1
  • 1
Ömer Faruk Kurt
  • 500
  • 3
  • 14