Home arrow JavaScript arrow Page 4 - Intergrate DWR into Your Java Web Application
JAVASCRIPT

Intergrate DWR into Your Java Web Application


If you want to build your Ajax application around a JavaScript framework, you will need to use Direct Web Remoting code. This article shows you how. It is excerpted from Hack 43 from the book Ajax Hacks, written by Bruce W. Perry (O'Reilly; ISBN: 0596101694). Copyright © 2007 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Author Info:
By: O'Reilly Media
Rating: 3 stars3 stars3 stars3 stars3 stars / 2
July 24, 2008
TABLE OF CONTENTS:
  1. · Intergrate DWR into Your Java Web Application
  2. · Configuring the Application
  3. · Direct Web Remoting (DWR) for Java Jocks
  4. · Direct Web Remoting (DWR) for Java Jocks continued

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Intergrate DWR into Your Java Web Application - Direct Web Remoting (DWR) for Java Jocks continued
(Page 4 of 4 )

 


Figure 5-1.  Calling a Java method remotely
   <script type="text/javascript" src=
         
"/[name of web app]/dwr/engine.js"></script>
  <script type="text/javascript" src=
          "/[name of web app]/dwr/util.js"></script>

Think back to the simple XML file that we just added to the web application. The first twoscripttags reference the JavaScript names we bound to the Java classes that we want to remote:JsBikeBeanandJsDate. The XML file configured certain Java classes to be used with these names in JavaScript code. Remember the dwr.jar file that we installed in the web application? It contains two JavaScript libraries, engine.js and util.js. The first of these files is required to use DWR; the second is optional and contains a bunch of DWR functions that the client-side code can use.

The URL that thescripttag uses, such as /parkerriver/dwr/interface/JsBean.js, connects to the special DWR servlet that we enabled. The servlet in turn makes available to our code the public methods of the Java classes that we configured in XML. The next few hacks will use these classes and functions. 


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials