I have worked with struts 1,2 for around an year. Now I need to work on DWR which is nothing but an easy way of using ajax.
So this question is about how ajax make the data retrieval from server very fast as compared to struts. I did surf thru many articles on net. I came up with this understanding that in case of struts complete forms/form data get submitted and after data retrieaval complete page gets loaded which is not the case with ajax.
What happens in ajax is we hit the required java class on server with the minimal data we need to send and after returning from server that particular ui element is refreshed which is main reason why it is faster.
Is it correct?
Yes, it is correct. AJAX allows loading only portions of a page.
It doesn't mean it's necessarily faster, though. If each click consists in making 5 requests to refresh 5 parts, there is a good chance a single request to refresh the wole page will be faster.
As always, AJAX is only a tool. If used badly, it won't lead to good results.