Skip to main content

[webtier] JSF 2.0 Ajax question

3 replies [Last post]
Anonymous

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.
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rogerk
Offline
Joined: 2004-05-06
Points: 0

The new behavior model we are working on for 2.0 will allow you to do somthing like this:

-roger

Jim Driscoll

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

Lincoln Baxter, III

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]