[webtier] JSF 2.0 Ajax question

You are here:

Just a quick question in case this use case isn't already out there. How
would I use the current JSF 2.0 ajax functionality to call a server-side
method through ajax, preferably without needing to render a hidden
command***** field. Is that possible?

Lincoln Baxter, III wrote:
> Just a quick question in case this use case isn't already out there. How
> would I use the current JSF 2.0 ajax functionality to call a server-side
> method through ajax, preferably without needing to render a hidden
> command***** field. Is that possible?
>
> A4J enabled this through the tag.

I'm not sure I understand exactly what you're asking for (I don't know
A4J), but attaching an ActionListener to a an action calls that method
when it's used for Ajax (and you can do something similar with
ValueChangeListener). Is that what you're looking for? The method
signatures aren't arbitrary (which might be what you mean by hidden
fields), but it can do any action within that constraint. The docs I
found for jsfunction (athttp://www.jboss.org/file-access/default/members/jbossajax4jsf/freezone/...)
seems to imply similar usage.

The demos (even the simple ones) have that usage sprinkled about - I
still need to write a demo that does a ValueChange using the js
functions, but the ajax-tag demo does that using the tag.

Awesome. I'll check out your blogs. What I'm concerned about is the
ability to call a server-side function, and retrieve results, without
the need for attaching it to another component. It's just standalone,
providing a javascript function to perhaps be consumed by a window
on-load event, or timer event. (For instance, if I wanted to send the
position of the mouse-cursor back to the server every 0.5 seconds.)

--Lincoln

On Sun, 2009-01-11 at 17:00 -0800, Jim Driscoll wrote:

> Lincoln Baxter, III wrote:
> > Just a quick question in case this use case isn't already out there. How
> > would I use the current JSF 2.0 ajax functionality to call a server-side
> > method through ajax, preferably without needing to render a hidden
> > command***** field. Is that possible?
> >
> > A4J enabled this through the tag.
>
>
>
> I'm not sure I understand exactly what you're asking for (I don't know
> A4J), but attaching an ActionListener to a an action calls that method
> when it's used for Ajax (and you can do something similar with
> ValueChangeListener). Is that what you're looking for? The method
> signatures aren't arbitrary (which might be what you mean by hidden
> fields), but it can do any action within that constraint. The docs I
> found for jsfunction (at
> http://www.jboss.org/file-access/default/members/jbossajax4jsf/freezone/...)
> seems to imply similar usage.
>
> The demos (even the simple ones) have that usage sprinkled about - I
> still need to write a demo that does a ValueChange using the js
> functions, but the ajax-tag demo does that using the tag.
>
> Let me know if that answers your question.
>
> Jim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
[att1.html]