For Sales Enquiry, call: +91 789 216 9998 For HR Enquiry, call: +91 804 166 0003 Skype: globussoftsupport

Progressing towards Innovation...


Direct Web Remoting (DWR) - Globussoft

June 19, 2014by GLBADMIN75

Hi I am Laxmi Kiran, lead of JAVA team at Globussoft. I have about three and a half years of experience in JAVA. Here I’d like to introduce Direct Web Remoting (DWR) Technology to the common mass.

What is DWR?

Direct Web Remoting (DWR) is a Java library that enables Java on the server and JavaScript in a browser to interact and call each other as simply as possible. It gives the AJAX implementation of XML HTTP Request to the DWR library and allows developers to concentrate on business objects.

AJAX made simple with DWR

AJAX helps to build a good desktop-like user interface in the browser and helps for interactive interfaces that can even replace traditional user interfaces.

Communication between browser and server is done in the background and because only the data is transferred between the browser and the server, AJAX applications seem to be, and are actually, fast and responsive to the users.

DWR will generate the JavaScript to allow web browsers to securely call into Java code almost as if it is running locally. It can marshal virtually any data including collections, POJO’s, XML and binary data like images and PDF files.

With Reverse Ajax, DWR allows java code running on a server to use client side API’s to publish updates to arbitrary groups of browsers. This allows interaction 2 ways – browser calling server and server calling browser. DWR supports Comet, Polling and Piggyback (sending data in with normal requests) as ways to publish to browser.

DWR consists of two parts:

•A Java Servlet running on the server that processes requests and sends responses back to browser
•JavaScript running on the browser that sends request and dynamically updates the browser

Here is how it works:

As browser sends a request dynamically.

DWR allows Java code running on the server to find out what clients are viewing certain pages, and to send to them JavaScript, generated either manually or using Java API.

Example of DWR in 7 steps

1.Download dwr.jar file. Place it in your WEB-INF/lib directory of your web application. (

2.Download commons-logging jar files and place it in your WEB-INF/lib directory along with dwr.jar (

3.Add the DWR Servlet definition and mapping to your applications web.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<display-name>DWR Servlet</display-name>

4.Write your business logic (Java code)

This is an example java code for a java class

5.Create the DWR configuration file (dwr.xml) place it with your web.xml dwr.xml contains the mapping of your Java code to the front end. Where ever you want to call the java code you can just call the value in ‘javascript’ attribute as shown.

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE dwr PUBLIC “-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN” “”>

<create creator=”new” javascript=”Calculator”>
<param name=”class” value=”org.globussoft.example1.Calculator”/>


6.Open default page to check

Now clean and build the project and run the project. Browser opens with URL— ‘http://localhost:8090/DWRExample/’. Just add ‘dwr’ in the URL and press enter. You will be redirected to this URL—http://localhost:8090/DWRExample/dwr/index.html
(Note: If end of URL contains some ‘index.jsp’ or ‘index.html’ just remove it and type ‘dwr’ (http://localhost:8090/DWRExample/dwr))

Click on hyperlink, you will be redirected to another page as shown below:

Ex:<script type=’text/javascript’ src=’/DWRExample/dwr/engine.js’></script>
<script type=’text/javascript’ src=’/DWRExample/dwr/interface/Calculator.js’>

This page contains the external JavaScript file links developed by DWR framework. Just copy the three script tags and place in your specified jsp(front end). Above links in the image are given below.

7.Create front end

Write the html code for the required page and place the special JavaScript code links as shown below:
At the end of this file you can find the html code.

Now your front end is ready with dynamic JavaScript generated by DWR Framework. Now you can run your project which gives dynamic responses.

Finally end page after running the project as below:








<%@page contentType=”text/html” pageEncoding=”UTF-8″%><!DOCTYPE html>
<html> <head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>My First DWR Page</title>
<script type=’text/javascript’ src=’/DWRExample/dwr/engine.js’></script>
<script type=’text/javascript’ src=’/DWRExample/dwr/interface/Calculator.js’></script>
<script type=’text/javascript’ src=’/DWRExample/dwr/util.js’></script>
A:<input type=”text” id=”a”/>
B:<input type=”text” id=”b”/>
<input type=”button” value=”Add” onclick=”Calculator.add(a.value,b.value,response)”/>
<input type=”button” value=”Subtract” onclick=”Calculator.subtract(a.value,b.value,response)”/>
<input type=”button” value=”Multiply” onclick=”Calculator.multiply(a.value,b.value,response)”/>
<input type=”button” value=”Divide” onclick=”Calculator.divide(a.value,b.value,response)”/>
<script type=”text/javascript”>
var response=function(data){
if(data != null && typeof data==’object’){ alert(dwr.util.toDescriptiveString(data,2)); }
else{ dwr.util.setValue(“answerdiv”,dwr.util.toDescriptiveString(data,1)); }
Answer:<div id=”answerdiv”></div>

I hope I have been able to introduce you to DWR. Thank you for reading. I look forward to reading your ideas on this.



  • SMS

    July 17, 2020 at 9:19 am

    bookmarked!!, I like your blog!


  • buy CBD

    August 1, 2020 at 3:11 pm

    Greetings from California! I’m bored at work so I decided to
    check out your blog on my iphone during lunch break. I love the knowledge you present
    here and can’t wait to take a look when I get home.
    I’m amazed at how fast your blog loaded on my mobile .. I’m not even using WIFI, just 3G ..
    Anyhow, awesome blog!

    Here is my webpage … buy CBD


  • Pingback: hscuae

  • free xbox codes

    August 19, 2020 at 8:23 am

    You have made some decent points there. I checked on the internet to find out
    more about the issue and found most people will go along
    with your views on this web site.


  • Pingback: susanavello

  • Pingback: borinsel

  • articole pescuit

    August 23, 2020 at 6:03 pm

    Hello there, You’ve done an incredible job.
    I’ll certainly digg it and personally recommend to my friends.
    I am sure they will be benefited from this site.


  • v bucks free generator

    August 25, 2020 at 9:58 am

    I’m not sure why but this web site is loading incredibly slow for me.
    Is anyone else having this problem or is it a problem on my
    end? I’ll check back later and see if the problem still exists.


  • Jarrod

    August 25, 2020 at 12:28 pm

    That is a good tip particularly to those fresh to the blogosphere.
    Brief but very accurate information… Thanks for sharing this
    one. A must read post!

    my website Jarrod


  • see my site

    August 27, 2020 at 2:52 pm

    Good day! Do you know if they make any plugins to
    assist with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing
    very good success. If you know of any please share.


  • fake watches

    August 27, 2020 at 7:54 pm

    A beautiful time piece for the collection.


  • Alexis

    August 28, 2020 at 2:55 pm

    great watch, fast shipping!!!


  • fake rolex watches

    August 29, 2020 at 9:44 am

    beautiful replicawatch, very stylish, best for business casual


  • how to cheat on pokemon go

    August 29, 2020 at 5:09 pm

    You made some decent points there. I checked on the web for
    additional information about the issue and found most people will go along with your views on this web site.


  • psn free codes

    August 31, 2020 at 9:01 am

    Very nice post. I just stumbled upon your weblog and wished to
    say that I have truly enjoyed browsing your blog posts.
    After all I’ll be subscribing to your rss feed and I hope you
    write again soon!


  • hack brawl stars

    August 31, 2020 at 1:07 pm

    Write more, thats all I have to say. Literally, it seems as though you relied on the video
    to make your point. You obviously know what youre talking about, why waste your intelligence
    on just posting videos to your site when you could be giving us something informative
    to read?


  • coin master free spins

    August 31, 2020 at 1:46 pm

    You’ve made some decent points there. I checked on the internet to find out more
    about the issue and found most people will go along with your views on this site.


  • get free robux fast

    August 31, 2020 at 3:43 pm

    With havin so much written content do you ever run into any problems of
    plagorism or copyright infringement? My blog has a lot of unique content I’ve either created myself or outsourced but it appears
    a lot of it is popping it up all over the web without my permission. Do you know any ways to help prevent content from being ripped off?

    I’d truly appreciate it.


  • fortnite free vbucks

    September 1, 2020 at 1:39 am

    Every weekend i used to pay a quick visit this website, because i want
    enjoyment, for the reason that this this web site
    conations genuinely pleasant funny material too.


  • avast internet security serial key

    September 6, 2020 at 7:49 pm

    I like what you guys are up too. This sort of clever work and reporting!
    Keep up the superb works guys I’ve added you guys
    to blogroll.


  • avast driver updater key

    September 6, 2020 at 8:10 pm

    Hello there! Do you use Twitter? I’d like to follow you if
    that would be okay. I’m absolutely enjoying your blog and look forward to new posts.


  • avast premier keygen

    September 6, 2020 at 9:02 pm

    Ahaa, its nice discussion regarding this paragraph here
    at this webpage, I have read all that, so at this time me also commenting at this place.


  • coin master link

    September 7, 2020 at 1:48 am

    Does your site have a contact page? I’m having a tough time locating it but,
    I’d like to send you an e-mail. I’ve got some ideas for your blog
    you might be interested in hearing. Either way, great site and I look forward
    to seeing it develop over time.


  • coin master spin

    September 7, 2020 at 2:58 am

    I’ll immediately grab your rss as I can not in finding your email
    subscription link or newsletter service. Do you’ve any?
    Please allow me know in order that I could subscribe.



  • Pingback: proelbra

  • free coinmaster spins

    September 11, 2020 at 10:47 am

    Thanks for a marvelous posting! I truly enjoyed reading it, you’re a
    great author.I will remember to bookmark your blog and will often come back sometime soon. I want to encourage continue your great
    job, have a nice weekend!


  • free coinmaster spins

    September 11, 2020 at 11:06 am

    I loved as much as you’ll receive carried out right here. The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get bought an impatience over that
    you wish be delivering the following. unwell unquestionably come further formerly again as
    exactly the same nearly a lot often inside case you shield this increase.


  • coin master free spins

    September 11, 2020 at 12:56 pm

    What’s up, constantly i used to check blog posts here in the early hours in the dawn, since i like to find out
    more and more.


  • free coin master spins

    September 11, 2020 at 2:37 pm

    Hey there! I’ve been following your weblog for
    some time now and finally got the courage to go ahead
    and give you a shout out from Huffman Texas! Just
    wanted to tell you keep up the fantastic work!


  • free spins coin master

    September 11, 2020 at 2:46 pm

    Hello, after reading this awesome article i am as well cheerful to share my familiarity here
    with friends.


  • free coin master spins

    September 11, 2020 at 3:51 pm

    Hey there! I know this is kinda off topic but I was wondering which blog
    platform are you using for this website? I’m getting fed up of WordPress because I’ve had problems with hackers and I’m
    looking at options for another platform. I would be
    fantastic if you could point me in the direction of a good platform.


  • Pingback: napscorp

  • free netflix account generator

    September 15, 2020 at 4:35 pm

    When someone writes an paragraph he/she retains the plan of a user in his/her
    mind that how a user can understand it. Therefore that’s why this paragraph is outstdanding.


  • bingo blitz freebies

    September 16, 2020 at 2:29 am

    If some one wishes to be updated with most recent technologies after
    that he must be go to see this web page and be up to date all the time.


  • free vbucks

    September 16, 2020 at 6:28 am

    Howdy! I could have sworn I’ve been to this site before
    but after going through some of the posts I realized it’s new to me.
    Regardless, I’m certainly delighted I found it and I’ll
    be bookmarking it and checking back regularly!


  • roy jones jr vs mike tyson full match online

    September 17, 2020 at 1:23 pm

    This design is steller! You certainly know how to keep a reader
    amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Great job.
    I really loved what you had to say, and more than that,
    how you presented it. Too cool!


  • free robux

    September 19, 2020 at 4:27 am

    Hey there, You have done a fantastic job. I’ll definitely digg
    it and personally suggest to my friends. I am confident they’ll be benefited from this site.


  • Pingback: civasclinic

  • free robux website

    September 22, 2020 at 4:04 am

    Fantastic beat ! I would like to apprentice whilst you amend your website,
    how can i subscribe for a weblog website?
    The account aided me a acceptable deal. I were tiny bit acquainted of this your broadcast provided
    vibrant transparent concept


  • mike tyson vs roy jones live stream

    September 23, 2020 at 4:22 am

    I’m not that much of a online reader to be
    honest but your sites really nice, keep it up!
    I’ll go ahead and bookmark your site to come back in the
    future. All the best


  • Teddy Geani

    September 24, 2020 at 3:56 am

    This is a terribly sharp post. Thankyou fitted posting this amazing article.



  • free netflix account generator

    September 25, 2020 at 9:50 am

    Thanks for a marvelous posting! I certainly enjoyed reading it, you may be a great author.
    I will remember to bookmark your blog and may come back later in life.
    I want to encourage you to ultimately continue your great job, have a nice day!


  • free itunes gift card generator

    September 25, 2020 at 12:33 pm

    Heya i am for the primary time here. I came across this board and I to find
    It really useful & it helped me out much. I hope to provide something
    back and help others such as you helped me.


  • steam wallet codes generator

    September 25, 2020 at 2:09 pm

    Hello Dear, are you in fact visiting this site daily, if so then you will absolutely get nice experience.


  • fortnite account generator

    September 25, 2020 at 3:58 pm

    It’s a shame you don’t have a donate button! I’d certainly donate to this
    superb blog! I guess for now i’ll settle for book-marking and adding your
    RSS feed to my Google account. I look forward to new updates and will talk about this site with
    my Facebook group. Chat soon!


  • robux generator

    September 25, 2020 at 4:22 pm

    Hello to every one, the contents present at this website are genuinely
    amazing for people experience, well, keep up the nice work fellows.


  • vbucks genetator

    September 25, 2020 at 6:08 pm

    Hey there would you mind stating which blog platform you’re working
    with? I’m looking to start my own blog in the near
    future but I’m having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.

    The reason I ask is because your design and style seems different then most blogs and I’m looking for something unique.

    P.S My apologies for getting off-topic but I had to ask!


  • amazon gift card free

    September 25, 2020 at 6:18 pm

    Hello, I think your blog might be having browser compatibility issues.
    When I look at your website in Firefox, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a quick heads up!
    Other then that, very good blog!


  • coin master free spins

    September 25, 2020 at 9:33 pm

    Every weekend i used to go to see this web page, for the reason that
    i want enjoyment, since this this website conations in fact good
    funny stuff too.


  • free psn codes generator

    September 25, 2020 at 11:54 pm

    Hi, this weekend is nice for me, for the reason that this time i am reading this wonderful
    educational piece of writing here at my residence.


  • free robux generator

    September 27, 2020 at 11:36 am

    I’m not sure why but this web site is loading very slow for me.
    Is anyone else having this issue or is it a problem on my end?

    I’ll check back later on and see if the problem
    still exists.


  • psn codes free

    September 27, 2020 at 12:58 pm

    My brother suggested I may like this blog. He was entirely
    right. This submit truly made my day. You can not consider simply how much time I had spent for this info!


  • articles

    October 1, 2020 at 1:27 am

    Good article. I’m experiencing many of these issues as well..


Leave a Reply

Your email address will not be published. Required fields are marked *

Social Networks

Copyright © 2006-2020 Globussoft Technologies