Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different between dwr and jquery ajax?

Tags:

java

jquery

dwr

I would like to know more about using Ajax with DWR and Jquery Ajax in Java. Is there any advantage over the other?

like image 348
Prathap Avatar asked May 31 '12 07:05

Prathap


People also ask

What is difference between AJAX and jQuery AJAX?

AJAX is a web development technique for making asynchronous calls to the server. jQuery is a JavaScript library for designing and make some web development tasks easy. It makes it possible to run javascript outside of the browser.

Is jQuery and AJAX the same?

The key difference between Ajax and jQuery is that the jQuery is more like a Frame Work, which is built using JavaScript while Ajax is a technique or a way of using JavaScript for communicating with the server without reloading a web page. jQuery uses Ajax for many of its functions.

Which is better jQuery or AJAX?

jQuery uses ajax for many of its functions, but it nothing else than a library that provides easier functionality. With jQuery you dont have to think about creating xml objects ect ect, everything is done for you, but with straight up javascript ajax you need to program every single step of the ajax call.

What is the difference between jQuery get () and jQuery AJAX ()?

get() executes an Ajax GET request. The returned data (which can be any data) will be passed to your callback handler. $(selector). load() will execute an Ajax GET request and will set the content of the selected returned data (which should be either text or HTML).


1 Answers

In the simplest terms, DWR is an engine that exposes methods of server-side Java objects to JavaScript code. Effectively, with DWR, you can eliminate all of the machinery of the Ajax request-response cycle from your application code. This means your client-side code never has to deal with an XMLHttpRequest object directly, or with the server's response. You don't need to write object serialization code or use third-party tools to turn your objects into XML. You don't even need to write servlet code to mediate Ajax requests into calls on your Java domain objects.

DWR is deployed as a servlet within your Web application. Viewed as a black box, this servlet performs two major roles: First, for each exposed class, DWR dynamically generates JavaScript to include in your Web page. The generated JavaScript contains stub functions that represent the corresponding methods on the Java class and also performs XMLHttpRequests behind the scenes. These requests are sent to the DWR servlet, which, in its second role, translates the request into a method call on a server-side Java object and sends the method's return value back to the client side in its servlet response, encoded into JavaScript. DWR also provides JavaScript utility functions that help perform common UI tasks.

like image 147
Pramod Kumar Avatar answered Oct 03 '22 11:10

Pramod Kumar