I'm sure what you've found on the net is sufficient, but in case it isn't, here's a quick example I just threw together:

http://www.omnytex.com/XMLHTTPRequestExample.htm

Note that if a URL you are trying to access isn't in the same domain, then at least on Firefox you will get an access denied exception.

That example shows two things: retrieving a URL and displaying it in a table, and updating the options of a <select> element. I think the later is probably quite applicable.

Obviously you'll want to target some Action rather than an actual URL as I've done, but the process is identical.

Also, I think it is very important to note that you *DO NOT* have to send back XML, contrary to the objects' name! In fact I've found for a great many things your life will be considerably simpler to not send back XML (such as updating a select like in the example). You need to make that determination of course depending on what you are doing. But, XML parsing on the client tends to be a bit on the slow side, so I wouldn't do it unless you have a reason for it being XML. Especially if you can't be sure you won't be returning a huge document.

Then again, in a service-oriented world where "services" tends to be synonymous with "web service", which tends to be synonymous with XML, it's something to think about. Then again, no one said a Web Service has to be XML-based either! :)

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

StÃphane Zuckerman wrote:
I would highly recommend using XmlHttpRequest (aka ajax), which is much
more user-friendly, much quicker to use and more flexible than reloading
the page each time the user clicks on something.


This is a solution I wasn't aware of... And it would be a really great one, provided I could find a way to use it in my application. Would you happen to have some code examples I could use to understand better how ajax works ? I found some pretty useful stuff here :

http://www.xml.com/pub/a/2005/02/09/xml-http-request.html

and there are other papers available that I haven't had time to read, but none with a J2EE example (or even better, a Struts example)...

Thanks anyway, that was really useful ! I might not be able to use this technology for this project, but I certainly will for another one !

StÃphane

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









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



Reply via email to