You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Jouravlev <jm...@gmail.com> on 2006/07/27 01:24:32 UTC

Re: [ANNOUNCE] New article: The AjaxParts Taglib from Java Web Parts: AJAX for Java Developers the Easy (yet powerful) Way!

On 7/26/06, Frank W. Zammetti <fz...@omnytex.com> wrote:
> Hi everyone,
>
> I've gotten a number of requests for an article on AjaxParts Taglib, and
> I finally got around to writing it :)  You can check it out here:
>
> http://www.omnytex.com/articles
>
> If you have never heard of AjaxParts Taglib before, in brief, AjaxParts
> Taglib, a component of the Java Web Parts Project
> (http://javawebparts.sourceforge.net), is a taglib that allows for easy,
> declarative, event-driven AJAX, allowing a developer to add AJAX
> capabilities to existing or new webapps without the need to write ANY
> JavaScript at all!  This article demonstrates how it works, explains the
> benefits, and goes into some details about the capabilities it offers
> out-of-the-box, as well as the ways in which it can be extended to
> fulfill far more advanced users.
>
> Hope it is helpful, and take care!
>
> Frank

Frank,

great stuff! I haven't read the whole article yet :-) so just a quick question:

say I have this button:

<input type="button" value="Click me for AJAX"><ajax:event
ajaxRef="MyFunctions/Button1" />

and I defined the "onclick" event in <ajaxConfig>.

What will happen if I define another onclick handler right in the
"input" element like

<input type="button" value="Click me for AJAX" onclick="return
doMyCustomStuff();"><ajax:event ajaxRef="MyFunctions/Button1" />

Basically, how do you handle custom Javascript?

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [ANNOUNCE] New article: The AjaxParts Taglib from Java Web Parts: AJAX for Java Developers the Easy (yet powerful) Way!

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Thanks Michael, I appreciate you taking the time to look!

Excellent question... the answer is that the code that APT writes into 
the onClick handler for the button will append itself onto whatever is 
there already, it WILL NOT overwrite your existing code.  This wasn't 
always true, but is as of a couple of versions ago :)

FYI, if you were going where I think you might have been going... you 
can't use this to abort the request.  For instance, you might expect that...

if (!shouldAJAXRequestFire())) { return; }

...would stop the request form firing, since the APT code would follow 
this.  But, it doesn't work.  I'm actually a little surprised by that, I 
had to go try it to be sure... I guess the JS interpreter doesn't treat 
what's in onClick like a function, it's instead just a collection of 
statements that it interprets, return not aborting that interpretation.

However, it is already on our to-do list to provide this ability... we 
already have the preProc that gets called before the request, we'll 
probably examine the return from that and if false, abort the request. 
We also were thinking of adding an <if> child element under the <event> 
element where you could put a Javascript snippet, and if it returns 
false, that aborts the request.  Not sure which way we'll go yet (maybe 
both)... there is a feature request on the SF site, if anyone has an 
opinion, I'd love to have it recorded :)

Frank

Michael Jouravlev wrote:
> On 7/26/06, Frank W. Zammetti <fz...@omnytex.com> wrote:
>> Hi everyone,
>>
>> I've gotten a number of requests for an article on AjaxParts Taglib, and
>> I finally got around to writing it :)  You can check it out here:
>>
>> http://www.omnytex.com/articles
>>
>> If you have never heard of AjaxParts Taglib before, in brief, AjaxParts
>> Taglib, a component of the Java Web Parts Project
>> (http://javawebparts.sourceforge.net), is a taglib that allows for easy,
>> declarative, event-driven AJAX, allowing a developer to add AJAX
>> capabilities to existing or new webapps without the need to write ANY
>> JavaScript at all!  This article demonstrates how it works, explains the
>> benefits, and goes into some details about the capabilities it offers
>> out-of-the-box, as well as the ways in which it can be extended to
>> fulfill far more advanced users.
>>
>> Hope it is helpful, and take care!
>>
>> Frank
> 
> Frank,
> 
> great stuff! I haven't read the whole article yet :-) so just a quick 
> question:
> 
> say I have this button:
> 
> <input type="button" value="Click me for AJAX"><ajax:event
> ajaxRef="MyFunctions/Button1" />
> 
> and I defined the "onclick" event in <ajaxConfig>.
> 
> What will happen if I define another onclick handler right in the
> "input" element like
> 
> <input type="button" value="Click me for AJAX" onclick="return
> doMyCustomStuff();"><ajax:event ajaxRef="MyFunctions/Button1" />
> 
> Basically, how do you handle custom Javascript?
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org