aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes what is dwr? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "what is dwr?" Watch "what is dwr?" New topic
Author

what is dwr?

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

In attempt to answer what is DWR, I've quoted part of the book description from Amazon.

The Ajax craze is sweeping the world, and there is no shortage of libraries from which to choose to make it all easier to develop. One of those libraries has risen near the top in the Java space, and that library is DWR. DWR, or Direct Web Remoting, allows you to treat your Java classes running on the server as if they were local objects running in the browser, bringing the full power of your server-side business logic to the client without the usual problems that entails


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
akhilesh pandey
Greenhorn

Joined: May 02, 2007
Posts: 6
Yes we can call java object from browser. But is really it execure on client machine? I think it can not, it need to go server sytem and execute there. How it is possible to run on client machine? Can you explain it?
Akhilesh
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61063
    
  66

It doesn't run on the client. No one said it did. DWR uses Ajax and servlet technology to allow a sort of RPC from the browser to Java classes on the server.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Frank Malinowski
Ranch Hand

Joined: Jul 24, 2003
Posts: 30
Originally posted by Bear Bibeault:
It doesn't run on the client. No one said it did. DWR uses Ajax and servlet technology to allow a sort of RPC from the browser to Java classes on the server.


What types of variables does it have the ability to send to and receive from the server? Primitives? Arrays? Multi-dimensional data structures? I just want to get a feel for the depth and breadth of the classes and methods it will be able to interact with.

Thanks,
Frank
Ghulam Rasool Raja
Greenhorn

Joined: Mar 10, 2007
Posts: 10
You are able to send and recieve primitives, arrays, even you can recieve a list of objects / beans from the server. You can configure it in your dwr.xml using converter tag to convert a java bean into a javascript object. You have to write some getter methods in your jsp to access the data in the object returned.
Tina Ma
Ranch Hand

Joined: Nov 29, 2007
Posts: 198
Is there a DWR API online to refer to?


Tina
SCJP 1.4, SCWCD 1.4
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

Originally posted by sreerupa basu:
Is there a DWR API online to refer to?

The JavaDoc API
Frank Zammetti
Ranch Hand

Joined: Dec 16, 2004
Posts: 136
It's perhaps not the most important point, but this statement: "You have to write some getter methods in your jsp to access the data in the object returned." isn't really accurate.

When DWR marshalls a Java object to Javascript, say an instance of this class:

public class Person {
private String firstName;
private String lastName;
public String getFirstName() { return firstName; }
public String getLastName() { return lastName; }
}

...what you get in Javascript is this:

{ firstName: "xxx", lastName: "yyy" }

...where xxx and yyy are the values of the fields obviously. So, to access them, you have only to do:

o.firstName

That assumes the variable o represents that object shown there. There's no methods present, and there's no need to write any methods to get the data, you simply access it directly like this.

I suspect that's what you meant ot say Ghulam, just wanted to clarify for anyone else reading this.


-- <br />Frank W. Zammetti<br />Founder and Chief Software Architect<br />Omnytex Technologies<br /><a href="http://www.omnytex.com" target="_blank" rel="nofollow">http://www.omnytex.com</a><br />AIM/Yahoo: fzammetti<br />MSN: fzammetti@hotmail.com<br />Author of "Practical Ajax Projects With Java Technology"<br /> (2006, Apress, ISBN 1-59059-695-1)<br />and "JavaScript, DOM Scripting and Ajax Projects"<br /> (2007, Apress, ISBN 1-59059-816-4)<br />Java Web Parts - <a href="http://javawebparts.sourceforge.net" target="_blank" rel="nofollow">http://javawebparts.sourceforge.net</a><br /> Supplying the wheel, so you don't have to reinvent it!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is dwr?