myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "daniel ccss" <danielcc...@gmail.com>
Subject Re: Call Backing Bean Method in onload event
Date Mon, 05 Nov 2007 21:40:04 GMT
In Google I find this solution:

you can try body on~load calls a javascript method, then in the javascript
method calls a commandbutton which is hidden. that commandbutton can then
call a method in your backing bean.

code:
------------------------------


function test(){
  document.getElementById('formName:buttonId').click();
}

<body on~load="test();">

<h:commandButton action="#{backingBean.methodName}" id="buttonId"
style="display: none"/>
</body>


Any other idea??





On 11/5/07, daniel ccss <danielccss2@gmail.com> wrote:
>
> Hi all,
>
> I need to call a method on my backing bean (is in session scope) when a
> jsp is showing. Why? Because I some cases I need to erase some elements in
> session before showing the jsp. So in the onload of the JSPs I need to call
> the method on my backing bean that erase the elements in session.
>
> So my question is, how to call a Baccking Bean method on the onLoad event
> of the body in the JSP.
>
> Thanks
>

Mime
View raw message