Tomahawk has the add javascript function via AddResource. I do not know where
to put the javascript code. body onload, page header, or somewhere else? Poll
is ajax call.
The Java code (backing bean):
public String send()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = (ExtendedRenderKitService)
Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext,
"alert('Script added by ExtendedRenderKitService')");
//do real logic
return ("success");
}
The JSPX file:
<af:commandButton id="button1" text="press me"
action="#{helloWorldBacking.send}"/>
I am trying to understand where javascript code is put on the page and how it
get executed.
Thanks
Dave
--- On Tue, 5/12/09, Richard Yee <[email protected]> wrote:
From: Richard Yee <[email protected]>
Subject: Re: [RichFaces]-Poll server, alert server side message, possible?
To: "MyFaces Discussion" <[email protected]>
Date: Tuesday, May 12, 2009, 7:57 PM
It is built-in to the component.
You don't need to write any javascript.
Richard
Sent from my iPhone
On May 12, 2009, at 6:05 PM, Dave <[email protected]> wrote:
Thanks for replies.
The poll is ajax call. Where is the javascript code put in the page? how will
it be called? on page load? if on page load, it will not be called since it is
ajax request.
thanks,
Dave
--- On Tue, 5/12/09, Cagatay Civici <[email protected]> wrote:
From: Cagatay Civici <[email protected]>
Subject: Re: [RichFaces]-Poll server, alert server side message, possible?
To: "MyFaces Discussion" <[email protected]>
Date: Tuesday, May 12, 2009, 1:25 AM
Well this is MyFaces mailing list, not richfaces so we can come up with myfaces
related solutions.
Go for Matthias's suggestion is optimal for this requirement since server sends
the requests not client.
On Tue, May 12, 2009 at 8:13 AM, Matthias Wessendorf <[email protected]> wrote:
use Trinidad.
There is a poll component as well, and a much nicer way to send JavaScript calls
to the client (from the server):
http://www.jroller.com/mwessendorf/entry/using_extendedrenderkitservice
-Matthias
On Tue, May 12, 2009 at 9:08 AM, Dave <[email protected]> wrote:
> I like to use RichFaces Poll server side new messages. If there are new
> messages, then pop up alert window, saying "3 new messages". From the Poll
> tag, can oncomplete javascript be bound to server side bean property? If
> so, the alert message can be dynamically generated in server side.
>
> Thanks
> Dave
>
--
Matthias Wessendorf
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf