Michael Jouravlev wrote:
Frank, please ignore my ignorance,

Ignorance is thinking you know something when you don't... not knowing something you have no experience with isn't :)

> if I understand correctly, an
Action still returns a full page, but your JS engine parses the
response and pulls out only relevant "ajaxified" parts and replaces
them in a page? So, if I need to print out error messages, I just need
to mark <html:errors/> tag with <ajax:enable /> ?

No, that isn't quite right...

What APT does is "attaches" AJAX events to an element on a page (it can theoretically be any DOM element). This attached event fires in response to one of the usual event handlers, i.e., onClick, onBlur, whatever (you can also have an AJAX event that fires continuously via timer, and you can also have a function rendered that you can call at will to fire an AJAX event which is still configured like any other).

So, when working with Struts, your Action (or more usually, a JSP) can really render whatever it wants... APT has nothing to say about that (at this point... some plans in the works). Most of the time is would probably NOT be a full page... then, back on the client, APT kicks in again via a response handler, and does something with the response. That "something" can be updating a <div>, populating a <select>, doing an XSLT transformation, popping an alert, or a number of other things (and that's the just standard handlers... with a custom handlers, the possibilities are limited only by your imagination).

Now, one new capability that a lot of people were asking for is the ability to use APT tags in a response rendered by a JSP that is itself called as the result of an AJAX call... imagine a button on a page that, when clicked, adds a new item entry line to a list. This new line will contain two text fields, one of which you want to fire an AJAX event onBlur for. Previously, you had to do some somewhat annoying things to make that happen, now it's perfectly natural: just use the tags in a JSP that renders the markup for that new item line.

Specifically on your question of rendering <html:errors/>, you would first need to decide how you want to display the errors... in a popup? In a <div>? Something else? Whatever the case, you create a JSP that contains that <html:errors/> tag, and that might in fact be the ONLY thing in that JSP. Then, you configure a response handler to display it however you want. Nothing more to it.

> What if I print
errors separately for every input field, will this still work?

Yes, it can, it all depends on what events fire the AJAX call, and what you do with the response. APT is a bit more low-level than some other libraries in that we don't really say much about what you do or how you do it, we just provide tools that we feel makes it really easy to do whatever you want, and saves you from doing Javascript coding yourself (usually, custom handlers excepted).

I think grabbing JWP and looking at the sample app is the best way to go... there is a page with probably close to 20 different usages of APT, and I think if you look at that and then glance at the JSP, it'll become clear pretty quickly (there's also a cookbook that might be helpful, although it hasn't been updated for beta5 yet).

Frank

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to