1

I am wondering if there is a way to call a managed bean method before render response. I have components that depend on a managed bean property but that property needs to be populated before the render response. Normally, I have been using @PostContruct method to initialize my bean and everything is good. This time I have a rare situation where I need the template to pass a value to the bean before anything else happens.

I have JSF 2.2.12 and Tomcat 7. I tried the f:viewAction but that tag will not fire the bean method. It doesn't work at all.

This is what I have for viewAction.

<f:metadata>
    <f:viewAction action="#{cmsUtil.loadPageAssignments('50|27|1|21|2|52|53|23|24|25|28|29|30|31|32|33|17|26|18')}"/>
</f:metadata>

Is there any other way to do what I am trying to do?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I was able to get the viewAction to work. The problem was that the tag wasn't working inside a base template file. It seems to want to work on the initial facelets file. Is there a way to have it work on an template facelets file? – user2677597 Jan 18 '16 at 02:02
  • Note: I edited out the wrong requirement. You described the view build time, not the view render time. See also http://stackoverflow.com/q/3342984 – BalusC Jan 18 '16 at 09:49

1 Answers1

0

Looks like viewAction cannot be in template files. Okay, so database config it is then. Thanks.