user321068
user321068

Reputation:

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.

Upvotes: 4

Views: 4379

Answers (2)

Damian Wieliczko
Damian Wieliczko

Reputation: 11

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

<jsfc:verbatim>
    <script type="text/javascript">
        window.onload = doSome();
    </script>
</jsfc:verbatim>

Upvotes: 1

BalusC
BalusC

Reputation: 1109625

Use <a4j:jsFunction>.

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

Upvotes: 2

Related Questions