Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

what is dwr?

 
author & internet detective
Posts: 41086
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a DWR API online to refer to?
 
Jeanne Boyarsky
author & internet detective
Posts: 41086
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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


The JavaDoc API
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic