Search code examples
javajavascriptjsfrichfaces

RichFaces 3.3: Calling actionListener on window.onload


I'd like to call an ActionListener and rerender some parts of my page when the page has been loaded (window.onload). How can I do this?


I can't edit the body tag. I've got a portlet inside a portal server.


Solution

  • Use <a4j:jsFunction>.

    <h:form>
        <a4j:jsFunction name="init" actionListener="#{bean.init}" reRender="some" />
    </h:form>
    <script>window.onload = init;</script>