You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Peter Locke <pl...@abebooks.com> on 2006/09/21 23:57:08 UTC

AJAX and Velocity (again, building on the previous posts)

I was going to post a similar 'any tips on using AJAX and Velocity together'
topic when I noticed there was already some coverage on the mailing list.
Unfortunately all the links below seem to be dead.  I read Will's comments as
below, but unfortunately I think they are a bit over my head and that means I
need to learn some basic Ajax.  Does anyone have a good place to start?  We
already use the prototype JavaScript library for other non-ajax reasons, so I
would like to leverage that if it makes sense to do so.   There are many Ajax
helper frameworks out there that claim to be great and make life easier - is
that true and is there a particular one I should look to integrate into our
codebase?  

Any tips for an experienced J2EE/velocity engineer but AJAX rookie would be
appreciated.

Peter.



I use Velocity with Ajax to generate the server-side responses.  More 
> commonly I do JSON responses but have also done XML.  For me, the 
> Velocity does no parsing, merely generates the AJAX reponse like it
> would any other text.   It's convenient to specify a few lines of
> velocity, save it to my web directory, then retrieve with an AJAX 
> call.
>
> WILL

-----Original Message-----
From: Gyanesh M Khanolkar [mailto:gyanesh@thoughtcircle.com] 
Sent: Friday, August 25, 2006 11:22 PM
To: 'Velocity Users List'
Subject: RE: AJAX anyone?

Thanks all for your mails. For a starter like me, your mails have saved me a
lot of time.

Cheers!!!
G

-----Original Message-----
From: dizzi [mailto:dizzi@logout.sh.cvut.cz]
Sent: Saturday, August 26, 2006 4:08 AM
To: Velocity Users List
Subject: Re: AJAX anyone?

Ehm i dont understand why you are using xml. In most cases its useles (or
nuke on fly ;). Using rendered html fragments is usually straight solution

Check this:
http://today.java.net/pub/a/today/2005/10/27/sprinkle-ajax-magic-into-struts
-webapp.html?page=3

http://klokan.sh.cvut.cz/~dizzi/ajax.js
you can get this script - its slightly edited script from url above (ive
fixed some bugs with form handling and parameter encoding)

anytime you can get robust package like dojo - check this url:
http://www.firstpartners.net/red-piranha/knowledgebase/AjaxJavaLibraries


Best regards d.


On Fri, 25 Aug 2006 23:54:03 +0200, Gyanesh M Khanolkar
<gy...@thoughtcircle.com> wrote:

> Hi,
>
>
> I have been playing around with AJAX only to find the nightmare of 
> handling XML based Server responses. The pain area for any AJAX 
> developer seems to be parsing and embedding XML data inside a HTML 
> code that is eventually sits within a JavaScript. It makes life HELL 
> for developing and maintaining AJAX based sites when we have HTML + 
> XML handing code within a JavaScript.
>
>
> I seem to find the idea of using Velocity for AJAX based solutions 
> MUCH better to the ones many have been talking about. I think its cool 
> to shoot out the HTML code from template directly to the browser which 
> will just blindly paste it inside the right HTML pocket. Also when 
> running in a cached mode, I think we can achieve the desired response 
> levels as well !! Now this is cool !!!
>
>
> Anyone in the Dev community here also share the same views as I do? 
> Are there any issues you think that I should consider when including 
> Velocity for AJAX based solutions?
>
>
> Thanks,
>
> Gyanesh
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 8/25/2006


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: AJAX and Velocity (again, building on the previous posts)

Posted by Will Glass-Husain <wg...@forio.com>.
I use the prototype.js library.  Seems to improve productivity for
AJAX and Javascript work.  I like the Ajax.Updater method call which
can populate a div tag with a block of HTML loaded from a file.  (In
my case, often generated with Velocity).

WILL

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: AJAX and Velocity (again, building on the previous posts)

Posted by dizzi <di...@logout.sh.cvut.cz>.
1) honestly ive never heard about JSON before :D
2) after little searching ive find supported browsers:
"Internet Explorer 5.0 and up, Opera 7.6 and up, Netscape 7.1 and up,  
Firefox 1.0 and up, Safari 1.2 and up"
So i think that ajax support is not problem at all. Anyway you can on page  
load (onLoad()) try to make ajax object. In case of problem you can  
redirect to other page... or so.
3) i dont understand to your question, sry

d.



On Tue, 26 Sep 2006 00:51:02 +0200, Peter Locke <pl...@abebooks.com>  
wrote:

> Thanks, that script seems simple and effective.  Also I agree with your
> anti-XML sentiments, and not just in AJAX.
>
> A couple questions -
>
> 1) Where does JSON come into play and when/why would one use it?
> 2) Is there a way to gracefully handle the situation where a browser  
> does not
> support an AJAX call?  A popup error isn't really a good solution for an
> enterprise level e-commerce site.
> 3) Has anyone used the AJAX functions in the prototype JavaScript  
> library,
> and how do they compare to this?
>
> I will be attending the AJAX conference in Boston next month, if anyone  
> else
> is planning to be there from this list drop me an email.
>
>
> -----Original Message-----
> From: dizzi [mailto:dizzi@logout.sh.cvut.cz]
> Sent: Thursday, September 21, 2006 3:49 PM
> To: Velocity Users List
> Subject: Re: AJAX and Velocity (again, building on the previous posts)
>
> Hmm i dont know why i've deleted that .js file :)
>
> Link works fine again now :)
>
> http://klokan.sh.cvut.cz/~dizzi/ajax.js
>
> Notice that 1st link from my post below continues on next line, anyway  
> i've
> shorten it for you :)
>
> http://tinyurl.com/hahrg
>
> d.
>
> On Thu, 21 Sep 2006 23:57:08 +0200, Peter Locke <pl...@abebooks.com>
> wrote:
>
>> I was going to post a similar 'any tips on using AJAX and Velocity
>> together'
>> topic when I noticed there was already some coverage on the mailing  
>> list.
>> Unfortunately all the links below seem to be dead.  I read Will's
>> comments as below, but unfortunately I think they are a bit over my
>> head and that means I
>> need to learn some basic Ajax.  Does anyone have a good place to start?
>> We
>> already use the prototype JavaScript library for other non-ajax
>> reasons, so I
>> would like to leverage that if it makes sense to do so.   There are many
>> Ajax
>> helper frameworks out there that claim to be great and make life
>> easier
>> - is
>> that true and is there a particular one I should look to integrate
>> into our codebase?
>>
>> Any tips for an experienced J2EE/velocity engineer but AJAX rookie
>> would be appreciated.
>>
>> Peter.
>>
>>
>>
>> I use Velocity with Ajax to generate the server-side responses.  More
>>> commonly I do JSON responses but have also done XML.  For me, the
>>> Velocity does no parsing, merely generates the AJAX reponse like it
>>> would any other text.   It's convenient to specify a few lines of
>>> velocity, save it to my web directory, then retrieve with an AJAX
>>> call.
>>>
>>> WILL
>>
>> -----Original Message-----
>> From: Gyanesh M Khanolkar [mailto:gyanesh@thoughtcircle.com]
>> Sent: Friday, August 25, 2006 11:22 PM
>> To: 'Velocity Users List'
>> Subject: RE: AJAX anyone?
>>
>> Thanks all for your mails. For a starter like me, your mails have
>> saved me a lot of time.
>>
>> Cheers!!!
>> G
>>
>> -----Original Message-----
>> From: dizzi [mailto:dizzi@logout.sh.cvut.cz]
>> Sent: Saturday, August 26, 2006 4:08 AM
>> To: Velocity Users List
>> Subject: Re: AJAX anyone?
>>
>> Ehm i dont understand why you are using xml. In most cases its useles
>> (or nuke on fly ;). Using rendered html fragments is usually straight
>> solution
>>
>> Check this:
>> http://today.java.net/pub/a/today/2005/10/27/sprinkle-ajax-magic-into-
>> struts
>> -webapp.html?page=3
>>
>> http://klokan.sh.cvut.cz/~dizzi/ajax.js
>> you can get this script - its slightly edited script from url above
>> (ive fixed some bugs with form handling and parameter encoding)
>>
>> anytime you can get robust package like dojo - check this url:
>> http://www.firstpartners.net/red-piranha/knowledgebase/AjaxJavaLibrari
>> es
>>
>>
>> Best regards d.
>>
>>
>> On Fri, 25 Aug 2006 23:54:03 +0200, Gyanesh M Khanolkar
>> <gy...@thoughtcircle.com> wrote:
>>
>>> Hi,
>>>
>>>
>>> I have been playing around with AJAX only to find the nightmare of
>>> handling XML based Server responses. The pain area for any AJAX
>>> developer seems to be parsing and embedding XML data inside a HTML
>>> code that is eventually sits within a JavaScript. It makes life HELL
>>> for developing and maintaining AJAX based sites when we have HTML +
>>> XML handing code within a JavaScript.
>>>
>>>
>>> I seem to find the idea of using Velocity for AJAX based solutions
>>> MUCH better to the ones many have been talking about. I think its
>>> cool to shoot out the HTML code from template directly to the browser
>>> which will just blindly paste it inside the right HTML pocket. Also
>>> when running in a cached mode, I think we can achieve the desired
>>> response levels as well !! Now this is cool !!!
>>>
>>>
>>> Anyone in the Dev community here also share the same views as I do?
>>> Are there any issues you think that I should consider when including
>>> Velocity for AJAX based solutions?
>>>
>>>
>>> Thanks,
>>>
>>> Gyanesh
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
>>
>> --
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date:
>> 8/25/2006
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: AJAX and Velocity (again, building on the previous posts)

Posted by Peter Locke <pl...@abebooks.com>.
Thanks, that script seems simple and effective.  Also I agree with your
anti-XML sentiments, and not just in AJAX.

A couple questions - 

1) Where does JSON come into play and when/why would one use it?
2) Is there a way to gracefully handle the situation where a browser does not
support an AJAX call?  A popup error isn't really a good solution for an
enterprise level e-commerce site.
3) Has anyone used the AJAX functions in the prototype JavaScript library,
and how do they compare to this?

I will be attending the AJAX conference in Boston next month, if anyone else
is planning to be there from this list drop me an email.


-----Original Message-----
From: dizzi [mailto:dizzi@logout.sh.cvut.cz] 
Sent: Thursday, September 21, 2006 3:49 PM
To: Velocity Users List
Subject: Re: AJAX and Velocity (again, building on the previous posts)

Hmm i dont know why i've deleted that .js file :)

Link works fine again now :)

http://klokan.sh.cvut.cz/~dizzi/ajax.js

Notice that 1st link from my post below continues on next line, anyway i've
shorten it for you :)

http://tinyurl.com/hahrg

d.

On Thu, 21 Sep 2006 23:57:08 +0200, Peter Locke <pl...@abebooks.com>
wrote:

> I was going to post a similar 'any tips on using AJAX and Velocity 
> together'
> topic when I noticed there was already some coverage on the mailing list.
> Unfortunately all the links below seem to be dead.  I read Will's 
> comments as below, but unfortunately I think they are a bit over my 
> head and that means I
> need to learn some basic Ajax.  Does anyone have a good place to start?   
> We
> already use the prototype JavaScript library for other non-ajax 
> reasons, so I
> would like to leverage that if it makes sense to do so.   There are many  
> Ajax
> helper frameworks out there that claim to be great and make life 
> easier
> - is
> that true and is there a particular one I should look to integrate 
> into our codebase?
>
> Any tips for an experienced J2EE/velocity engineer but AJAX rookie 
> would be appreciated.
>
> Peter.
>
>
>
> I use Velocity with Ajax to generate the server-side responses.  More
>> commonly I do JSON responses but have also done XML.  For me, the 
>> Velocity does no parsing, merely generates the AJAX reponse like it
>> would any other text.   It's convenient to specify a few lines of
>> velocity, save it to my web directory, then retrieve with an AJAX 
>> call.
>>
>> WILL
>
> -----Original Message-----
> From: Gyanesh M Khanolkar [mailto:gyanesh@thoughtcircle.com]
> Sent: Friday, August 25, 2006 11:22 PM
> To: 'Velocity Users List'
> Subject: RE: AJAX anyone?
>
> Thanks all for your mails. For a starter like me, your mails have 
> saved me a lot of time.
>
> Cheers!!!
> G
>
> -----Original Message-----
> From: dizzi [mailto:dizzi@logout.sh.cvut.cz]
> Sent: Saturday, August 26, 2006 4:08 AM
> To: Velocity Users List
> Subject: Re: AJAX anyone?
>
> Ehm i dont understand why you are using xml. In most cases its useles 
> (or nuke on fly ;). Using rendered html fragments is usually straight 
> solution
>
> Check this:
> http://today.java.net/pub/a/today/2005/10/27/sprinkle-ajax-magic-into-
> struts
> -webapp.html?page=3
>
> http://klokan.sh.cvut.cz/~dizzi/ajax.js
> you can get this script - its slightly edited script from url above 
> (ive fixed some bugs with form handling and parameter encoding)
>
> anytime you can get robust package like dojo - check this url:
> http://www.firstpartners.net/red-piranha/knowledgebase/AjaxJavaLibrari
> es
>
>
> Best regards d.
>
>
> On Fri, 25 Aug 2006 23:54:03 +0200, Gyanesh M Khanolkar 
> <gy...@thoughtcircle.com> wrote:
>
>> Hi,
>>
>>
>> I have been playing around with AJAX only to find the nightmare of 
>> handling XML based Server responses. The pain area for any AJAX 
>> developer seems to be parsing and embedding XML data inside a HTML 
>> code that is eventually sits within a JavaScript. It makes life HELL 
>> for developing and maintaining AJAX based sites when we have HTML + 
>> XML handing code within a JavaScript.
>>
>>
>> I seem to find the idea of using Velocity for AJAX based solutions 
>> MUCH better to the ones many have been talking about. I think its 
>> cool to shoot out the HTML code from template directly to the browser 
>> which will just blindly paste it inside the right HTML pocket. Also 
>> when running in a cached mode, I think we can achieve the desired 
>> response levels as well !! Now this is cool !!!
>>
>>
>> Anyone in the Dev community here also share the same views as I do?
>> Are there any issues you think that I should consider when including 
>> Velocity for AJAX based solutions?
>>
>>
>> Thanks,
>>
>> Gyanesh
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 
> 8/25/2006
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: AJAX and Velocity (again, building on the previous posts)

Posted by dizzi <di...@logout.sh.cvut.cz>.
Hmm i dont know why i've deleted that .js file :)

Link works fine again now :)

http://klokan.sh.cvut.cz/~dizzi/ajax.js

Notice that 1st link from my post below continues on next line, anyway  
i've shorten it for you :)

http://tinyurl.com/hahrg

d.

On Thu, 21 Sep 2006 23:57:08 +0200, Peter Locke <pl...@abebooks.com>  
wrote:

> I was going to post a similar 'any tips on using AJAX and Velocity  
> together'
> topic when I noticed there was already some coverage on the mailing list.
> Unfortunately all the links below seem to be dead.  I read Will's  
> comments as
> below, but unfortunately I think they are a bit over my head and that  
> means I
> need to learn some basic Ajax.  Does anyone have a good place to start?   
> We
> already use the prototype JavaScript library for other non-ajax reasons,  
> so I
> would like to leverage that if it makes sense to do so.   There are many  
> Ajax
> helper frameworks out there that claim to be great and make life easier  
> - is
> that true and is there a particular one I should look to integrate into  
> our
> codebase?
>
> Any tips for an experienced J2EE/velocity engineer but AJAX rookie would  
> be
> appreciated.
>
> Peter.
>
>
>
> I use Velocity with Ajax to generate the server-side responses.  More
>> commonly I do JSON responses but have also done XML.  For me, the
>> Velocity does no parsing, merely generates the AJAX reponse like it
>> would any other text.   It's convenient to specify a few lines of
>> velocity, save it to my web directory, then retrieve with an AJAX
>> call.
>>
>> WILL
>
> -----Original Message-----
> From: Gyanesh M Khanolkar [mailto:gyanesh@thoughtcircle.com]
> Sent: Friday, August 25, 2006 11:22 PM
> To: 'Velocity Users List'
> Subject: RE: AJAX anyone?
>
> Thanks all for your mails. For a starter like me, your mails have saved  
> me a
> lot of time.
>
> Cheers!!!
> G
>
> -----Original Message-----
> From: dizzi [mailto:dizzi@logout.sh.cvut.cz]
> Sent: Saturday, August 26, 2006 4:08 AM
> To: Velocity Users List
> Subject: Re: AJAX anyone?
>
> Ehm i dont understand why you are using xml. In most cases its useles (or
> nuke on fly ;). Using rendered html fragments is usually straight  
> solution
>
> Check this:
> http://today.java.net/pub/a/today/2005/10/27/sprinkle-ajax-magic-into-struts
> -webapp.html?page=3
>
> http://klokan.sh.cvut.cz/~dizzi/ajax.js
> you can get this script - its slightly edited script from url above (ive
> fixed some bugs with form handling and parameter encoding)
>
> anytime you can get robust package like dojo - check this url:
> http://www.firstpartners.net/red-piranha/knowledgebase/AjaxJavaLibraries
>
>
> Best regards d.
>
>
> On Fri, 25 Aug 2006 23:54:03 +0200, Gyanesh M Khanolkar
> <gy...@thoughtcircle.com> wrote:
>
>> Hi,
>>
>>
>> I have been playing around with AJAX only to find the nightmare of
>> handling XML based Server responses. The pain area for any AJAX
>> developer seems to be parsing and embedding XML data inside a HTML
>> code that is eventually sits within a JavaScript. It makes life HELL
>> for developing and maintaining AJAX based sites when we have HTML +
>> XML handing code within a JavaScript.
>>
>>
>> I seem to find the idea of using Velocity for AJAX based solutions
>> MUCH better to the ones many have been talking about. I think its cool
>> to shoot out the HTML code from template directly to the browser which
>> will just blindly paste it inside the right HTML pocket. Also when
>> running in a cached mode, I think we can achieve the desired response
>> levels as well !! Now this is cool !!!
>>
>>
>> Anyone in the Dev community here also share the same views as I do?
>> Are there any issues you think that I should consider when including
>> Velocity for AJAX based solutions?
>>
>>
>> Thanks,
>>
>> Gyanesh
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 8/25/2006
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org