It seems rather weird to me for the browser to invoke code on the server like 
this. I cannot imagine why you would want to do this.

However you can also use XmlHttpRequest from javascript to invoke stuff on the 
server. This can be coded directly or you can use something like "Shale 
Remoting". It appears to me that you are trying to invoke a *method* on the 
server rather than fetch a *page*. While a jsf page can be abused to trigger a 
method by "clicking a button", it is nicer to avoid misusing JSF, and use 
XmlHttpRequest or remoting.

Regards,

Simon

---- daniel ccss <[EMAIL PROTECTED]> schrieb:
> 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 <[EMAIL PROTECTED]> 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
> >

Reply via email to