I've used JQuery with WebObjects and it works. It's advantage is its lighter than prototype/scriptaculous at only 19k for the core library, it's fast and it's got a very nice syntax and it's non intrusive on your code. It's what I started out using before Prototype so I prefer it probably only for that reason. I've used it in a couple of ways mostly to do nice client side javascript for animations, tabs, modal dialogs, lightboxes etc but also some server side interaction aswell.

At the simplest it lets you get things on the page and do stuff to it very easily. For example I've used it to dynamically add a css class to every submit button and checkbox in any form so that I don't have to remember to do it myself. This lets me style those elements differently from normal input types. To do this only takes $("input [EMAIL PROTECTED]").addClass("checkbox"); notice you can mix and match CSS and XPath selectors which is cool.

In terms of Ajax it also does everything, but be warned you'll end up reinventing much of the WOnder Ajax framework so check there first to see if that does what you need, it probably does. As example though of how it can be easy with JQuery is how I've used it make any form into an Ajax submitting form just by adding a CSS class. There are many plugins around JQuery and this ajax form is one of them. To implement it is again as simple as including a .js with a one liner $ (".aFormToSubmitWIthAjax").ajaxForm(someOptionsArray). I modify my form action in WebObjects to return just a response of validation messages in a <ul> (so really it's AJAH) and the message gets pushed into a div of your choice automatically by the plugin. You're done an Ajax submitting form in WebObjects with very little work.

One thing which really drew me to it in terms of WebObjects development was that everything by design is encouraged to go in a seperate .js which initialises your page when the document loads binding all the behaviours to the different elements. This is nothing new here but it does encourage working in a way that makes it possible to have absolutely no javascript inline with your HTML or Java which I prefer because I despised writing javascript in my Java and .wod files. I keep thinking the holy grail here as a developer wanting to use javascript extensively with WebObjects is to extend the .wo to include a .js and have WebObjects dynamically include this script in the page when it processes the component. At the moment you have to hardcode it in or borrow from Ajax.framework and addScriptResourceInHead();

The big downside with JQuery is that because of the use of the dollar syntax it's incompatible with Prototype (therefore the Ajax Framework) although I believe there is some kind of compatibility mode you can put jquery into. Running two javascript frameworks though seems a little indulgent. Therefore if what you need to do is in the Ajax.framework and your doing lots of server side interaction with WebObjects then use that otherwise you're reinventing the wheel. That framework keeps getting better and better and all the hard work has been done for you. On the other hand if you want to experiment with JQuery go for it, as a relative newcomer to javascripting my experience with it has been a good one and I've been able to get some really nice results in a very short amount of time.

Good places to start with JQuery

http://jquery.com/
http://docs.jquery.com/Plugins
http://interface.eyecon.ro/demos

Paul

On Jun 20, 2007, at 4:14 AM, [EMAIL PROTECTED] wrote:



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to