You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andrew Robinson <an...@gmail.com> on 2007/08/03 18:25:26 UTC

[AJAX] choosing an AJAX solution...

I've started a project on the side using JSF and am trying to decide
on an AJAX component library. I'm debating between using A4J, which I
have used before and Trinidad, which I have not. Here are the
libraries that I have decided it must work with:

MyFaces 1.1.5 (or 1.2.0)
Tomahawk 1.1.6
Facelets 1.1.11
JBoss Seam 1.2.1

Functionality I would like/require:
* re-rendering of specific components
* submission, decoding, validating and updating of only select components
* ability to run custom busy java script code to be run while AJAX
request is being processed
* Clear API for writing custom components to leverage AJAX functionality
* Clear API for specifying re-rendered components in backing bean actions
* ability to run javascript after an AJAX call is complete that
differs per-component
* clear javascript hooks into the client side API for customizing the behavior
* ability to skip the update phase to just check for
validation/conversion errors (would be nice functionality)

Would like to see these types of components:
* SPAN/DIV AJAX "areas" to be able to re-render them to AJAX enable
non-ajaxed components
* ability to specify which components to submit/decode/validate/update
(tomahawk sandbox subForm can work if it resorts to that)
* polling component
* ajax-enabled include that works with JSF navigation (would be nice)
* ajax on event functionality (re-render such-and-such when a select
box changes value for example)

Ajax4JSF has all this functionality and I like it but I have issues
with it, and I want to see what the Trinidad team has to say.

Problems I have with A4J:
* LGPL license, so no hope of components written by the Apache team
that will work with it
* Very limited component library that supports it (RichFaces)
* RichFaces lacks many components that are "standard"
* RichFaces API is lacking as well as the quality (I find that if you
use their controls slightly differently than they tested them you
starting hitting all kinds of problems)

>From what I have seen so far with trinidad, I have not seen any of the
ajax functionality really exposed. Are there any components equivalent
to a4j:support, a4j:region, a4j:poll?

How easy is it to write custom trinidad ajax components?

So really, I just want to hear how the trinidad functionality stacks
up against A4J

Thanks,
Andrew

Re: [AJAX] choosing an AJAX solution...

Posted by Martin Marinschek <ma...@gmail.com>.
>> * ajax-enabled include that works with JSF navigation (would be nice)

>Hrm, no.  That would be cool.

I've done something like this for a client - using a custom navigation
handler. Worked well, even though we had a few problems with Facelets
id-handling...

regards,

Martin

On 8/4/07, Andrew Robinson <an...@gmail.com> wrote:
> Adam,
>
> That is great. I can't believe the response time. It is greatly
> appreciated. I will give Trinidad a shot over A4J on this project as I
> prefer to stay with Apache as much as possible.
>
> Thank you,
> Andrew
>
> On 8/3/07, Adam Winer <aw...@gmail.com> wrote:
> > On 8/3/07, Adam Winer <aw...@gmail.com> wrote:
> > > On 8/3/07, Andrew Robinson <an...@gmail.com> wrote:
> > > > Is there JS documentation? I cannot find any on this function on the
> > > > myfaces trinidad site
> > >
> > > It's new for 1.0.2.  I really need to sit down and write some
> > > docs for this API.
> >
> > OK, I sat down and wrote up a chapter so this (and lots
> > of other PPR things) will be doc'd.  The XDOC for it's at:
> >
> > http://svn.apache.org/repos/asf/myfaces/trinidad/trunk/trinidad/src/site/xdoc/devguide/ppr.xml
> >
> > and it'll eventually be up at:
> >
> > http://myfaces.apache.org/trinidad/devguide/ppr.html
> >
> > -- Adam
> >
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: [AJAX] choosing an AJAX solution...

Posted by Andrew Robinson <an...@gmail.com>.
Adam,

That is great. I can't believe the response time. It is greatly
appreciated. I will give Trinidad a shot over A4J on this project as I
prefer to stay with Apache as much as possible.

Thank you,
Andrew

On 8/3/07, Adam Winer <aw...@gmail.com> wrote:
> On 8/3/07, Adam Winer <aw...@gmail.com> wrote:
> > On 8/3/07, Andrew Robinson <an...@gmail.com> wrote:
> > > Is there JS documentation? I cannot find any on this function on the
> > > myfaces trinidad site
> >
> > It's new for 1.0.2.  I really need to sit down and write some
> > docs for this API.
>
> OK, I sat down and wrote up a chapter so this (and lots
> of other PPR things) will be doc'd.  The XDOC for it's at:
>
> http://svn.apache.org/repos/asf/myfaces/trinidad/trunk/trinidad/src/site/xdoc/devguide/ppr.xml
>
> and it'll eventually be up at:
>
> http://myfaces.apache.org/trinidad/devguide/ppr.html
>
> -- Adam
>

Re: [AJAX] choosing an AJAX solution...

Posted by Adam Winer <aw...@gmail.com>.
On 8/3/07, Adam Winer <aw...@gmail.com> wrote:
> On 8/3/07, Andrew Robinson <an...@gmail.com> wrote:
> > Is there JS documentation? I cannot find any on this function on the
> > myfaces trinidad site
>
> It's new for 1.0.2.  I really need to sit down and write some
> docs for this API.

OK, I sat down and wrote up a chapter so this (and lots
of other PPR things) will be doc'd.  The XDOC for it's at:

http://svn.apache.org/repos/asf/myfaces/trinidad/trunk/trinidad/src/site/xdoc/devguide/ppr.xml

and it'll eventually be up at:

http://myfaces.apache.org/trinidad/devguide/ppr.html

-- Adam

Re: [AJAX] choosing an AJAX solution...

Posted by Adam Winer <aw...@gmail.com>.
On 8/3/07, Andrew Robinson <an...@gmail.com> wrote:
> > > * ability to skip the update phase to just check for
> > > validation/conversion errors (would be nice functionality)
> >
> > Trinidad has probably the most extensive set of fully
> > client-side conversion/validation checking out there,
> > obviating the need to post back to the server.
>
> While client side validation is nice, it is not a replacement to
> server-side validation. Sometimes validation needs to hit the database
> (like to see if a username is already taken), or sometimes validation
> is more complex (hibernate validation using the model for example).

100% total agreement - which is, in part, why the only way
to get client-side validation in Trinidad is by adding server-side
validators.  My point is more in reference to supporting postbacks
that just check validation, and skip update model - client-side
validation makes *that* a good bit less necessary.
>
> > > * ajax on event functionality (re-render such-and-such when a select
> > > box changes value for example)
> >
> > Yes (autoSubmit + partialTriggers).
>
> This seems a bit limiting. It doesn't look like autoSubmit lets the
> developer specify which events trigger the AJAX call (for example a
> specific key press).

autoSubmit means when the value changes, trigger AJAX
that will fire a valueChangeListener.  If you wanted a hook
other than valueChange, you could add onkeypress, etc.
handlers and do this yourself.

> Also there doesn't look like a comparable
> component to a4j:support that allows for additional functionality.

What additional functionality specifically?

> Example of that functionality: append "return false;" on the event of
> the component to swallow the HTML event, can work on any JSF component
> (including tomahawk components).
>
> I guess "TrPage.getInstance().sendFormPost(form, {yourparams]);" is
> required for this functionality?

Yes, I think that's what you're getting at.

> > > How easy is it to write custom trinidad ajax components?
> >
> > Pretty simple.  All you need to initiate a Trinidad AJAX request
> > from JS is:
> >   TrPage.getInstance().sendFormPost(form, {yourparams]);
> > (again, in 1.0.2)
>
> Is there JS documentation? I cannot find any on this function on the
> myfaces trinidad site

It's new for 1.0.2.  I really need to sit down and write some
docs for this API.

> Does this allow you to specify the components
> to be updated (replicate the partial trigger functionality)?

On the server-side, you can explicitly request a component
be repainted with RequestContext.addPartialTarget(UIComponent).
We don't currently have an API for driving this entirely from
the client-side, though it wouldn't be hard to add this.


>
> Couple of additional questions:
>
> Is there AJAX queue functionality (to be able to have simultaneous
> requests or have some wait for others)?

Currently, it is entirely queued.  JSF state saving really
doesn't permit non-queued requests.

> Is there a request delay feature? (fire the AJAX request on key down
> but no more than once per 5 seconds for example).

No, there's not.  You'd have to build that on top of this
(for auto-suggest, for example).

> Is there a way for components to specify their JavaScript and CSS file
> requirements so that they are loaded correctly before or during a
> partial rendering?

Yes, JS can be loaded during PPR.  CSS is generally handled via
an integrated skinning stylesheet that would already be present.

-- Adam


>
> Thanks,
> Andrew
>

Re: [AJAX] choosing an AJAX solution...

Posted by Andrew Robinson <an...@gmail.com>.
> > * ability to skip the update phase to just check for
> > validation/conversion errors (would be nice functionality)
>
> Trinidad has probably the most extensive set of fully
> client-side conversion/validation checking out there,
> obviating the need to post back to the server.

While client side validation is nice, it is not a replacement to
server-side validation. Sometimes validation needs to hit the database
(like to see if a username is already taken), or sometimes validation
is more complex (hibernate validation using the model for example).

> > * ajax on event functionality (re-render such-and-such when a select
> > box changes value for example)
>
> Yes (autoSubmit + partialTriggers).

This seems a bit limiting. It doesn't look like autoSubmit lets the
developer specify which events trigger the AJAX call (for example a
specific key press). Also there doesn't look like a comparable
component to a4j:support that allows for additional functionality.
Example of that functionality: append "return false;" on the event of
the component to swallow the HTML event, can work on any JSF component
(including tomahawk components).

I guess "TrPage.getInstance().sendFormPost(form, {yourparams]);" is
required for this functionality?

> > How easy is it to write custom trinidad ajax components?
>
> Pretty simple.  All you need to initiate a Trinidad AJAX request
> from JS is:
>   TrPage.getInstance().sendFormPost(form, {yourparams]);
> (again, in 1.0.2)

Is there JS documentation? I cannot find any on this function on the
myfaces trinidad site. Does this allow you to specify the components
to be updated (replicate the partial trigger functionality)?

Couple of additional questions:

Is there AJAX queue functionality (to be able to have simultaneous
requests or have some wait for others)?

Is there a request delay feature? (fire the AJAX request on key down
but no more than once per 5 seconds for example).

Is there a way for components to specify their JavaScript and CSS file
requirements so that they are loaded correctly before or during a
partial rendering?

Thanks,
Andrew

Re: [AJAX] choosing an AJAX solution...

Posted by Adam Winer <aw...@gmail.com>.
On 8/3/07, Andrew Robinson <an...@gmail.com> wrote:
> I've started a project on the side using JSF and am trying to decide
> on an AJAX component library. I'm debating between using A4J, which I
> have used before and Trinidad, which I have not. Here are the
> libraries that I have decided it must work with:
>
> MyFaces 1.1.5 (or 1.2.0)
> Tomahawk 1.1.6
> Facelets 1.1.11
> JBoss Seam 1.2.1
>
> Functionality I would like/require:
> * re-rendering of specific components

Yes.

> * submission, decoding, validating and updating of only select components

Not today, but on the table.

> * ability to run custom busy java script code to be run while AJAX
> request is being processed

Yes (in 1.0.2), including a skinnable statusIndicator component.

> * Clear API for writing custom components to leverage AJAX functionality

Easy.

> * Clear API for specifying re-rendered components in backing bean actions

Easy.

> * ability to run javascript after an AJAX call is complete that
> differs per-component

High priority for 1.0.3.

> * clear javascript hooks into the client side API for customizing the behavior

Would want more details to answer.

> * ability to skip the update phase to just check for
> validation/conversion errors (would be nice functionality)

Trinidad has probably the most extensive set of fully
client-side conversion/validation checking out there,
obviating the need to post back to the server.

> Would like to see these types of components:
> * SPAN/DIV AJAX "areas" to be able to re-render them to AJAX enable
> non-ajaxed components

Yep, but in fact non-ajaxed components can be re-rendered
without even relying on an area!

> * ability to specify which components to submit/decode/validate/update
> (tomahawk sandbox subForm can work if it resorts to that)

Not so much today.  Trinidad does have a subform, though,
and I'm eager to get some custom lifecycle support at least into
the Trinidad 1.2 version to limit the scope of postbacks.

> * polling component

Yes.

> * ajax-enabled include that works with JSF navigation (would be nice)

Hrm, no.  That would be cool.

> * ajax on event functionality (re-render such-and-such when a select
> box changes value for example)

Yes (autoSubmit + partialTriggers).

>
> Ajax4JSF has all this functionality and I like it but I have issues
> with it, and I want to see what the Trinidad team has to say.
>
> Problems I have with A4J:
> * LGPL license, so no hope of components written by the Apache team
> that will work with it
> * Very limited component library that supports it (RichFaces)
> * RichFaces lacks many components that are "standard"
> * RichFaces API is lacking as well as the quality (I find that if you
> use their controls slightly differently than they tested them you
> starting hitting all kinds of problems)
>
> From what I have seen so far with trinidad, I have not seen any of the
> ajax functionality really exposed. Are there any components equivalent
> to a4j:support, a4j:region, a4j:poll?

Trinidad has looots of AJAX functionality.  partialTriggers to
automatically repaint components.  Programmatic APIs
to request any component (even one not part of
Trinidad) to be repainted. a4j:poll == tr:poll.  A variety
of components that use AJAX to redraw themselves (and
children) as needed, like table and showDetail.

To be precise, until Trinidad 1.0.2, we haven't had "true"
AJAX support - it's used an old IFRAME-based technique
built before XMLHttp even existed.  1.0.2 (to be released
in a matter of days, available in snapshots)

> How easy is it to write custom trinidad ajax components?

Pretty simple.  All you need to initiate a Trinidad AJAX request
from JS is:
  TrPage.getInstance().sendFormPost(form, {yourparams]);
(again, in 1.0.2)

-- Adam


> So really, I just want to hear how the trinidad functionality stacks
> up against A4J
>
> Thanks,
> Andrew
>

Re: [AJAX] choosing an AJAX solution...

Posted by mi...@convergys.com.
I had problems doing certain types of page refreshes using Trinidad and 
Ajax4JSF.
See the mail list topic:  [Trinidad] Problems working with Ajax4JSF


"Andrew Robinson" <an...@gmail.com> wrote on 08/03/2007 
12:25:26 PM:

> I've started a project on the side using JSF and am trying to decide
> on an AJAX component library. I'm debating between using A4J, which I
> have used before and Trinidad, which I have not. Here are the
> libraries that I have decided it must work with:
> 
> MyFaces 1.1.5 (or 1.2.0)
> Tomahawk 1.1.6
> Facelets 1.1.11
> JBoss Seam 1.2.1
> 
> Functionality I would like/require:
> * re-rendering of specific components
> * submission, decoding, validating and updating of only select 
components
> * ability to run custom busy java script code to be run while AJAX
> request is being processed
> * Clear API for writing custom components to leverage AJAX functionality
> * Clear API for specifying re-rendered components in backing bean 
actions
> * ability to run javascript after an AJAX call is complete that
> differs per-component
> * clear javascript hooks into the client side API for customizing the 
behavior
> * ability to skip the update phase to just check for
> validation/conversion errors (would be nice functionality)
> 
> Would like to see these types of components:
> * SPAN/DIV AJAX "areas" to be able to re-render them to AJAX enable
> non-ajaxed components
> * ability to specify which components to submit/decode/validate/update
> (tomahawk sandbox subForm can work if it resorts to that)
> * polling component
> * ajax-enabled include that works with JSF navigation (would be nice)
> * ajax on event functionality (re-render such-and-such when a select
> box changes value for example)
> 
> Ajax4JSF has all this functionality and I like it but I have issues
> with it, and I want to see what the Trinidad team has to say.
> 
> Problems I have with A4J:
> * LGPL license, so no hope of components written by the Apache team
> that will work with it
> * Very limited component library that supports it (RichFaces)
> * RichFaces lacks many components that are "standard"
> * RichFaces API is lacking as well as the quality (I find that if you
> use their controls slightly differently than they tested them you
> starting hitting all kinds of problems)
> 
> From what I have seen so far with trinidad, I have not seen any of the
> ajax functionality really exposed. Are there any components equivalent
> to a4j:support, a4j:region, a4j:poll?
> 
> How easy is it to write custom trinidad ajax components?
> 
> So really, I just want to hear how the trinidad functionality stacks
> up against A4J
> 
> Thanks,
> Andrew