<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4861352563000674067</id><updated>2011-11-28T05:14:43.990+05:30</updated><category term='apache'/><category term='password strength'/><category term='EL'/><category term='jsp EL'/><category term='javascript'/><category term='xmpp'/><category term='mongo'/><category term='ajax'/><category term='struts validation'/><category term='property'/><category term='load'/><category term='modules'/><category term='reverse ajax'/><category term='DBD'/><category term='validator'/><category term='validation'/><category term='smack'/><category term='jmeter'/><category term='custom validator'/><category term='javascript remoting'/><category term='gtalk bot'/><category term='Dwr'/><category term='commons'/><category term='alert'/><category term='spring'/><category term='function'/><category term='DBD::MySql'/><category term='spring vs ejb3'/><category term='messages'/><category term='nosql'/><category term='MySql'/><category term='password meter'/><title type='text'>My experince with Open source</title><subtitle type='html'>Its all about my experiences with open source technologies</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-922736086491897621</id><published>2010-07-29T14:50:00.004+05:30</published><updated>2010-07-29T14:56:13.489+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='mongo'/><category scheme='http://www.blogger.com/atom/ns#' term='nosql'/><title type='text'>Mongo Cheat Sheet</title><content type='html'>These days NoSQL concept is hot.  I am doing some POC on mongodb.&lt;br /&gt;&lt;br /&gt;I am using  java driver to access mongodb, to use same DAO pattern and ORM like interface I am using&lt;a href="http://code.google.com/p/morphia/wiki/QuickStart"&gt; mongo-morphia&lt;/a&gt; library.&lt;br /&gt;&lt;br /&gt;Quick access to mongo commands, you can go through mongo &lt;a href="http://cheat.errtheblog.com/s/mongo"&gt;cheat sheet&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-922736086491897621?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/922736086491897621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=922736086491897621' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/922736086491897621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/922736086491897621'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2010/07/mongo-cheat-sheet.html' title='Mongo Cheat Sheet'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-240012567391364889</id><published>2010-02-09T17:13:00.002+05:30</published><updated>2010-02-09T18:49:50.789+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='jsp EL'/><category scheme='http://www.blogger.com/atom/ns#' term='EL'/><title type='text'>JSP 2.0 EL and Functions</title><content type='html'>In my last project I need to call some utility methods from my JSP to manipulate model data. I didn't wanted to use JSP scriplets within the JSP, so the solution was to use utility method via JSP2.0 EL feature.&lt;br /&gt;&lt;br /&gt;Approach I folowed was:&lt;br /&gt;1. Declare function in a tag library descriptor. &lt;br /&gt;&lt;br /&gt;&lt;pre class="cpp" name="code"&gt;&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;&lt;br /&gt;&lt;taglib xmlns="http://java.sun.com/xml/ns/j2ee"&lt;br /&gt;        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee&lt;br /&gt;        http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"&lt;br /&gt;        version="2.0"&gt;&lt;br /&gt;&lt;br /&gt; &lt;description&gt;Image Utility functions&lt;/description&gt;&lt;br /&gt; &lt;display-name&gt;Image Utility Tag Library&lt;/display-name&gt;&lt;br /&gt; &lt;tlib-version&gt;1.0&lt;/tlib-version&gt;&lt;br /&gt; &lt;short-name&gt;ImageUtility&lt;/short-name&gt;&lt;br /&gt; &lt;function&gt;&lt;br /&gt;  &lt;name&gt;getImagePath&lt;/name&gt;&lt;br /&gt;  &lt;function-class&gt;com.til.hk.utils.CommonUtils&lt;/function-class&gt;&lt;br /&gt;  &lt;function-signature&gt;java.lang.String getImagePath(java.lang.String, java.lang.String)&lt;/function-signature&gt;&lt;br /&gt; &lt;/function&gt;&lt;br /&gt; &lt;function&gt;&lt;br /&gt;  &lt;name&gt;getRelativeImagePath&lt;/name&gt;&lt;br /&gt;  &lt;function-class&gt;com.til.hk.utils.CommonUtils&lt;/function-class&gt;&lt;br /&gt;  &lt;function-signature&gt;java.lang.String getImagePath(java.lang.String)&lt;/function-signature&gt;&lt;br /&gt; &lt;/function&gt;&lt;br /&gt;&lt;/taglib&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. Store TLD under WEB-INF directory (/WEB-INF/tld/)&lt;br /&gt;3. Specify the function's prefix and the library's Uniform Resource Identifier (URI) in JSP file&lt;br /&gt;&lt;pre class="cpp" name="code"&gt;&lt;br /&gt;&lt;%@ taglib uri="/WEB-INF/tld/ImageManip.tld" prefix="image"%&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-240012567391364889?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/240012567391364889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=240012567391364889' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/240012567391364889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/240012567391364889'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2010/02/jsp-20-el-and-functions.html' title='JSP 2.0 EL and Functions'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-3495029608357865194</id><published>2010-02-04T11:33:00.004+05:30</published><updated>2010-02-04T11:42:28.724+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='alert'/><title type='text'>Using Alert conditionally</title><content type='html'>In my last project I faced a lot of Bugs filed by QC team related to test Alert pop-ups coming which were introduced by developers for debugging and they forgot to remove those.&lt;br /&gt;&lt;br /&gt;To get rid of this I used a wrapper function over alert() function which checks the value of a test variable if that is true then only alert() function will get called, this way I was able to control test alert pop-ups across the web application with single test variable.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="cpp"&gt;&lt;br /&gt; DEBUG = false;&lt;br /&gt; function prompt(text) {&lt;br /&gt;  if(DEBUG) {&lt;br /&gt;   alert(text);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-3495029608357865194?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/3495029608357865194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=3495029608357865194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/3495029608357865194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/3495029608357865194'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2010/02/using-altert-conditionally.html' title='Using Alert conditionally'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-5110133587865669339</id><published>2010-02-03T21:13:00.004+05:30</published><updated>2010-02-03T21:28:50.483+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='messages'/><category scheme='http://www.blogger.com/atom/ns#' term='property'/><title type='text'>Message Property Like functionality in Javascript</title><content type='html'>In my last project I was using JavaScript heavily which was using messages extensively.&lt;br /&gt;&lt;br /&gt;Repetition of same kind of messages from multiple places was becoming unmanageable to handle that I have written a JavaScript class which provides Text message with respect to the message code provided. &lt;br /&gt;&lt;br /&gt;This function works in two ways:&lt;br /&gt;1. With code only (Messages.getText("error.text"))&lt;br /&gt;2. With code and args (Messages.getText("error.invalid",args))&lt;br /&gt;   Here args is replacement for place holders like:&lt;br /&gt;   error.invalid = "Invalid input [1] for [0]"&lt;br /&gt;   So Invalid error message can be reused for multiple places where [1] will replace by value and [0] wil be replaced for Field name&lt;br /&gt;&lt;br /&gt;For function overloading I have used &lt;a href="http://ejohn.org/blog/javascript-method-overloading/"&gt;addMethod - By John Resig&lt;/a&gt; as reference&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="cpp"&gt;&lt;br /&gt;function addMethod(object, name, fn){&lt;br /&gt;    var old = object[ name ];&lt;br /&gt;    if ( old )&lt;br /&gt;        object[ name ] = function(){&lt;br /&gt;            if ( fn.length == arguments.length )&lt;br /&gt;                return fn.apply( this, arguments );&lt;br /&gt;            else if ( typeof old == 'function' )&lt;br /&gt;                return old.apply( this, arguments );&lt;br /&gt;        };&lt;br /&gt;    else&lt;br /&gt;        object[ name ] = fn;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function MessageProvider() {&lt;br /&gt;   this.msg = new Object();&lt;br /&gt;   this.msg['error.Login'] = 'Please login to submit link';&lt;br /&gt;   this.msg['error.invalid'] = 'Invalid input [1] for [0] [0] is invalid'; &lt;br /&gt;&lt;br /&gt;   addMethod(this, "getText", function(code){&lt;br /&gt;  return this.msg[code];&lt;br /&gt;   });&lt;br /&gt;   addMethod(this, "getText", function(code,args){&lt;br /&gt;        var text = this.msg[code];&lt;br /&gt;  for (var i = 0; i &lt; args.length; i++) {&lt;br /&gt;   var re = new RegExp('\\[' + i + '\\]', 'g');&lt;br /&gt;            var dest = args[i]; &lt;br /&gt;   //text = oldtext.replace(re,'’);&lt;br /&gt;   text = text.replace(re,dest); &lt;br /&gt;  }&lt;br /&gt;  return text;&lt;br /&gt;&lt;br /&gt;   });&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;var Messages = new MessageProvider();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now to use centralized messaging in javascript you need to add this code to .js File and include in your html&lt;br /&gt;Add all your messages to msg Object&lt;br /&gt;&lt;br /&gt;like :&lt;br /&gt;&lt;pre name="code" class="cpp"&gt;&lt;br /&gt; &lt;script&gt;&lt;br /&gt;    var args = new Array();&lt;br /&gt; args[0] = 'name';&lt;br /&gt; args[1] = 'ram';&lt;br /&gt; alert(Messages.getText('error.invalid',args));&lt;br /&gt;        alert(Messages.getText('error.Login',args));&lt;br /&gt;  &lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-5110133587865669339?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/5110133587865669339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=5110133587865669339' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/5110133587865669339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/5110133587865669339'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2010/02/message-property-like-functionality-in.html' title='Message Property Like functionality in Javascript'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-7185908205268296861</id><published>2010-02-03T19:47:00.003+05:30</published><updated>2010-02-03T20:17:14.869+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='load'/><category scheme='http://www.blogger.com/atom/ns#' term='jmeter'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Conflicts faced While Load Testing</title><content type='html'>I was working on load testing of a web application last month, results were very conflicting when I was accessing application from browser response was very good but while executing script from Jmeter throughput was very less.&lt;br /&gt;&lt;br /&gt;I had applied all possible optimizations like :&lt;br /&gt;1. Query Caching&lt;br /&gt;2. Output compression (mod_deflate)&lt;br /&gt;3. Minify JS and CSS&lt;br /&gt;&lt;br /&gt;but result was same. &lt;br /&gt;I enabled logs to see compression ratio and realized that Jmeter was not sending accept-encoding HTTP header so Apache was not sending compressed result and that was affecting throughput.&lt;br /&gt;After adding accept-encoding header throughput was as desired.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-7185908205268296861?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/7185908205268296861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=7185908205268296861' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/7185908205268296861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/7185908205268296861'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2010/02/conflicts-faced-while-load-testing.html' title='Conflicts faced While Load Testing'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-3509425192486728257</id><published>2009-12-22T21:26:00.003+05:30</published><updated>2009-12-22T21:34:31.344+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dwr'/><title type='text'>Using RemoveAllRows function with DIV based pattern</title><content type='html'>For quite long time we were not able to use DIV based HTML in our DWR based applications.&lt;br /&gt;&lt;br /&gt;DWR supports only tables to remove and add rows for any data. Now if your HTML contains DIV based pattern you can not clear and re-populate rows, you need to convert the design to TABLE.&lt;br /&gt;&lt;br /&gt;I have modified removeAllRows function frovided by util.js and achieved same for DIV&lt;br /&gt;&lt;pre name="code" class="cpp"&gt; &lt;br /&gt;dwr.util.removeAllRowsDiv = function(ele,options) {&lt;br /&gt;          return;&lt;br /&gt;         ele = document.getElementById(ele);&lt;br /&gt;         if (!options) options = {};&lt;br /&gt;           if (!options.filter) options.filter = function() { return true; };&lt;br /&gt;         if (ele == null) return;&lt;br /&gt;       &lt;br /&gt;           var child = ele.firstChild;&lt;br /&gt;           var next;&lt;br /&gt;         while (child != null) {&lt;br /&gt;           next = child.nextSibling;&lt;br /&gt;           if (options.filter(child)) {&lt;br /&gt;             ele.removeChild(child);&lt;br /&gt;           }&lt;br /&gt;           child = next;&lt;br /&gt;         }&lt;br /&gt;       };&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So Now by providing your parrent DIV id you can and pattern div Id you can acheive the same result.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-3509425192486728257?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/3509425192486728257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=3509425192486728257' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/3509425192486728257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/3509425192486728257'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2009/12/using-removeallrows-function-with-div.html' title='Using RemoveAllRows function with DIV based pattern'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-8259150144621879568</id><published>2009-03-07T18:47:00.005+05:30</published><updated>2009-07-24T17:57:56.027+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='gtalk bot'/><category scheme='http://www.blogger.com/atom/ns#' term='smack'/><category scheme='http://www.blogger.com/atom/ns#' term='xmpp'/><title type='text'>Secrets of implementing a Gtalk Bot</title><content type='html'>I have read an article on implementing a Gtalk bot. I found it intresting so, I thought to write the concepts behind Google Talk and implementing your own Google Talk Bot.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Google Talk&lt;/b&gt; (&lt;b&gt;GTalk&lt;/b&gt;) is a free Windows and web-based instant messaging application offered by &lt;a href="http://en.wikipedia.org/wiki/Google_Inc" title="Google Inc" class="mw-redirect"&gt;Google Inc&lt;/a&gt; .&lt;br /&gt;&lt;br /&gt;Instant messaging between the Google Talk servers and its clients uses an open protocol, &lt;a href="http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol" title="Extensible Messaging and Presence Protocol"&gt;XMPP&lt;/a&gt;, Protocol.&lt;br /&gt;&lt;br /&gt;XMPP  (Extensible Messaging and Presence Protocol) is an open technology for instant messaging. The core technology behind XMPP was invented by &lt;a href="http://www.xmpp.org/xsf/people/jer.shtml"&gt;Jeremie Miller&lt;/a&gt; in 1998, refined in the &lt;a href="http://xmpp.org/about/jabber.shtml"&gt;Jabber&lt;/a&gt; open-source community in 1999 and 2000, and formalized by the &lt;a href="http://www.ietf.org/"&gt;IETF&lt;/a&gt; in 2002 and 2003, resulting in publication of the &lt;a href="http://xmpp.org/rfcs/"&gt;XMPP RFCs&lt;/a&gt; in 200.&lt;br /&gt;&lt;br /&gt;Google talk uses XMPP for authentication, presence and messaging so any client that supports XMPP can connect to the Google Talk service . Google Talk seervice is hosted at talk.google.com on 5222 port.&lt;br /&gt;&lt;br /&gt;To write a Google Talk bot you need to implement XMPP client API of your choice in your choice of platform. For example &lt;a href="http://www.igniterealtime.org/projects/smack/index.jsp"&gt;SMACK&lt;/a&gt; is java XMPP client API.&lt;br /&gt;&lt;br /&gt;Steps required to write a Gtalk Bot:&lt;br /&gt;&lt;br /&gt;1. &lt;a href="http://www.igniterealtime.org/projects/smack/index.jsp"&gt;Download&lt;/a&gt; SMACK client API from&lt;br /&gt;2. Extract smack.jar, smackx.jar, smackx-debug.jar&lt;br /&gt;3. Write Gtalk Service Code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sending and Receiving Message using SMACK:&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="cpp"&gt;  &lt;br /&gt;&lt;br /&gt;public class MyGtalkClient implements MessageListener {&lt;br /&gt;&lt;br /&gt;  public void processMessage(Chat chat,Message message) {&lt;br /&gt;  /*Callback method from MessageListener interface .&lt;br /&gt;    It is called when a message is received */&lt;br /&gt;&lt;br /&gt;      System.out.println("Received message: " + message.getBody());&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public static void main(String [] args) throws XMPPException,IOException {&lt;br /&gt;   &lt;br /&gt;      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;&lt;br /&gt;      /*Login to GTalk service*/&lt;br /&gt;       ConnectionConfiguration config = new ConnectionConfiguration   (&lt;br /&gt;                                            "talk.google.com",&lt;br /&gt;                                            5222,&lt;br /&gt;                                            "gmail.com");&lt;br /&gt;      XMPPConnection connection = new XMPPConnection(config);&lt;br /&gt;&lt;br /&gt;      connection.connect(); /* Connect to the XMPP server */&lt;br /&gt;&lt;br /&gt;      connection.login("gtalkid","gtalk pass");&lt;br /&gt;      /*Enter your username &amp;amp; password to login to the gtalk service */&lt;br /&gt;      Chat chat = connection.getChatManager().createChat(&lt;br /&gt;                             your_friend_id",new MyGtalkClient());&lt;br /&gt;   &lt;br /&gt;      System.out.println(" ****Welcome to MyGtalkClient**** ");&lt;br /&gt;      System.out.println("****Enter your message, one per line ."+&lt;br /&gt;                          "To stop chat enter stop****");&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;        while( !(msg=br.readLine()).equals("stop")) {&lt;br /&gt;          chat.sendMessage(msg); //Send the message&lt;br /&gt;      }&lt;br /&gt;   &lt;br /&gt;      connection.disconnect() ; //Disconnect&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is a very basic example here your buddy is hard coded and you are initiating the chat.&lt;br /&gt;I will write implementing a calculator bot in next part which will provide concepts of listening for a packet, process that packet and send result back to  that user.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-8259150144621879568?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/8259150144621879568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=8259150144621879568' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/8259150144621879568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/8259150144621879568'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2009/03/secrets-of-implementing-gtalk-bot.html' title='Secrets of implementing a Gtalk Bot'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-2592025105722961376</id><published>2009-01-21T23:10:00.013+05:30</published><updated>2009-01-23T15:36:44.693+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='reverse ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='Dwr'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><title type='text'>Reverse Ajax with Spring and DWR</title><content type='html'>&lt;style&gt;&lt;br /&gt;pre {style.css (line 7)&lt;br /&gt;background:#FFFAF0 none repeat scroll 0 0;&lt;br /&gt;border-left:5px dotted #DDDDDD;&lt;br /&gt;color:#444444;&lt;br /&gt;line-height:1.3em;&lt;br /&gt;margin:0;&lt;br /&gt;padding:0.75em 0.75em 0.75em 10px;&lt;br /&gt;}&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;Ajax is used heavily for web 2.0 applications to provide enhance user experience, which allows a web page to be updated without the need of full refresh. Normally this updated information is pulled from client side.&lt;br /&gt;Javascript call is used to make an Ajax call to the server and received information is updated.&lt;br /&gt;But there are scenarios when server decides to update information on client side e.g. Chat applications, server side processing status, user presence etc.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In these situations server side "PUSH" is required instead of Client side "PULL". There are three techniques used for this purpose:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Polling (the browser sends requests at regular interval)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Comet (long lived HTTP connection connection is kept open and server keeps replying)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Piggyback (server waits for client to make request and sends update with that request data)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Configuration:&lt;/span&gt;&lt;br /&gt;1. Enable Reverse Ajax in DWR configuration&lt;br /&gt;There are two ways of going this:&lt;br /&gt;&lt;br /&gt;You can enable in DWR.xml&lt;span class="fullpost"&gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt; &amp;lt;servlet-name&amp;gt;dwr-invoker&amp;lt;/servlet-name&amp;gt;&lt;br /&gt; &amp;lt;servlet-class&amp;gt;org.directwebremoting.servlet.DwrServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt; &amp;lt;init-param&amp;gt;&lt;br /&gt;   &amp;lt;param-name&amp;gt;debug&amp;lt;/param-name&amp;gt;&lt;br /&gt;   &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;br /&gt; &amp;lt;/init-param&amp;gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    &amp;lt;init-param&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;      &amp;lt;param-name&amp;gt;activeReverseAjaxEnabled&amp;lt;/param-name&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;      &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    &amp;lt;/init-param&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;or if you are using DWR name spaces then you can provide entry in [Servlet Name]-servelt.xml&lt;br /&gt;&amp;lt;dwr:controller id="dwrController" debug="true"&amp;gt;&lt;br /&gt;  &lt;span style="font-weight: bold;"&gt;   &amp;lt;dwr:config-param name="activeReverseAjaxEnabled" value="true" /&amp;gt; &lt;/span&gt;&lt;br /&gt;&amp;lt;/dwr:controller&amp;gt;&lt;br /&gt;&lt;br /&gt;2. Enable Reverse Ajax in JSP&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;dwr.engine.setActiveReverseAjax(true);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3. Now we need to get Browser sessions from  server side and push content there:&lt;br /&gt;&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; WebContext wctx = WebContextFactory.get();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  String currentPage = wctx.getCurrentPage();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Get current page from webContext&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Collection sessions = wctx.getScriptSessionsByPage(currentPage);&lt;/span&gt;&lt;br /&gt;Get all other clients session&lt;br /&gt;&lt;br /&gt;After getting these sessions you can push data from here using proxy interface&lt;br /&gt; &lt;span style="font-weight: bold;"&gt;Util utilAll = new Util(sessions);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; utilAll.addOptions("chatlog", messages, "text");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Above lines will add messages collection to all the browsers under "chatlog" element&lt;br /&gt;&lt;br /&gt;Similarly you can execute scripts on browsers from server side.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; ScriptBuffer script = new ScriptBuffer();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  script.appendScript("receiveMessages(")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;              .appendData(messages)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;              .appendScript(");");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Above snippet will execute receiveMessages() javascript function on client side.&lt;br /&gt;&lt;br /&gt;This way you can have full control on client side from server side. Chat application, Stock Ticker control applications, mail client can use this feature effectively.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-2592025105722961376?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/2592025105722961376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=2592025105722961376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/2592025105722961376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/2592025105722961376'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2009/01/reverse-ajax-with-spring-and-dwr.html' title='Reverse Ajax with Spring and DWR'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-3741190012020700763</id><published>2008-09-20T18:21:00.002+05:30</published><updated>2008-09-20T19:19:29.703+05:30</updated><title type='text'>Logging  using Log4j</title><content type='html'>Logging is an important of any application. There are several APIs available majorly used are:&lt;br /&gt;1. Apache Log4J&lt;br /&gt;2. Java Logging (java.util.logging)&lt;br /&gt;&lt;br /&gt;Logging is required to monitor the state of the running application, debug the application,  ignorant developers heavily relies on &lt;span style="font-weight: bold;"&gt;System.out.println(), &lt;/span&gt;which is quite expensive in terms of resources and you dont have any way to manage these messages.&lt;br /&gt;&lt;br /&gt;To control this we have different API's like mentioned above.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Using Log4J from Apache: &lt;/span&gt;&lt;br /&gt;Log4j consists of 3 aspects: logger, appender and, layout relations between three can be expressed as "logger logs to an appender using a layout"&lt;br /&gt;&lt;br /&gt;Each class in an application can have seperate logger or a common logger, now this logger should know where to send request for logging. This where are known as &lt;span style="font-weight: bold;"&gt;appenders &lt;/span&gt;which can be:&lt;br /&gt;- FileAppender  (flat file)&lt;br /&gt;- JDBCAppender (database )&lt;br /&gt;- Console Appender (Console)&lt;br /&gt;- SMTPAppender (Email)&lt;br /&gt;- JMSAppender (to remote JMS servers)&lt;br /&gt;- SocketAppender (to remote server).&lt;br /&gt;there are few more.&lt;br /&gt;&lt;br /&gt;Now we need to decide what and how we want the out out of that log, this is decided by layout&lt;br /&gt;&lt;br /&gt;Each class can have a logger as mentioned above similarly each logger should have log level. There are five different log levels (ordered):&lt;br /&gt;- DEBUG&lt;br /&gt;- INFO&lt;br /&gt;- WARN&lt;br /&gt;- ERROR&lt;br /&gt;- FATAL&lt;br /&gt;&lt;br /&gt;To configure a class with a logger, appender, layout and log level we need to use an external configuration file (log4j.properties is the default)&lt;br /&gt;&lt;br /&gt;Sample configuratiion file is as:&lt;br /&gt;--------------------------------&lt;br /&gt;# Set root logger level to DEBUG and its only appender to CONSOLE.&lt;br /&gt;log4j.rootLogger=INFO, CONSOLE&lt;br /&gt;&lt;br /&gt;# A1 is set to be a ConsoleAppender.&lt;br /&gt;log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender&lt;br /&gt;&lt;br /&gt;# A1 uses PatternLayout.&lt;br /&gt;log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout&lt;br /&gt;log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n&lt;br /&gt;&lt;br /&gt;# Change the level of messages for various packages.&lt;br /&gt;log4j.logger.com.tj.cand.controller=WARN&lt;br /&gt;log4j.logger.com.tj.cand.domain=WARN&lt;br /&gt;log4j.logger.com.tj.cand.dao=DEBUG&lt;br /&gt;--------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Usage:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span id="intelliTxt"&gt;&lt;code&gt;&lt;span style="font-family: arial;"&gt;Logger log = Logger.getLogger(MyController.cla&lt;/span&gt;ss);&lt;br /&gt;log.info("This is a logging message);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-3741190012020700763?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/3741190012020700763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=3741190012020700763' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/3741190012020700763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/3741190012020700763'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2008/09/logging-using-log4j.html' title='Logging  using Log4j'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-1687261941085991663</id><published>2008-09-20T16:52:00.002+05:30</published><updated>2008-09-20T18:19:56.279+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='spring vs ejb3'/><title type='text'>Why Spring Framework</title><content type='html'>Last year I had to shift my web application to some latest framework.&lt;br /&gt;I decided to go for Spring Framework, EJB3 was also an option.&lt;br /&gt;&lt;br /&gt;The reason why Spring was:&lt;br /&gt;&lt;br /&gt;1. Spring was a well established Open Source&lt;br /&gt;2. Spring provides all the configurations into XML where as EJB3.0 relies in annotations, in my scenario I am using WebSphere 6.1 which runs on JDK1.4 which doesn't support annotations.&lt;br /&gt;&lt;br /&gt;3. Spring is a loosely coupled Framework You can decide your own stack. Whereas EJB is whole integrated package.&lt;br /&gt;&lt;br /&gt;4. One major reason was You are not forced to use any Spring imports or rely on Spring classes. Dependency Injection combined with external meta-data helps to achieve this independence. So you can easily migrate. While in case of EJB 3.0 this is different.&lt;br /&gt;&lt;br /&gt;5. One disadvantage of using annotations based EJB 3.0 is you need to change java source to incorporate any configurations whereas in case of spring you need to change XML file.&lt;br /&gt;&lt;span&gt;&lt;br /&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-1687261941085991663?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/1687261941085991663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=1687261941085991663' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/1687261941085991663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/1687261941085991663'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2008/09/why-spring-framework.html' title='Why Spring Framework'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-4767644351666319937</id><published>2008-03-26T08:35:00.001+05:30</published><updated>2008-03-26T15:00:31.510+05:30</updated><title type='text'>XML binding using JiBX</title><content type='html'>JiBX is a XML binding framework which binds XML to your java class.&lt;br /&gt;XML binding is a 2 phase process:&lt;br /&gt;1. JiBX uses binding definition to define the rule how conversion wil happen and modifies byte code of the class.&lt;br /&gt;2. In phase 2 JiBX runtime does marshalling and un-marshalling of java objects to populate XML to java and java 2 XML.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Algorithm&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Add following jar files to your lib directory from JiBX distribution&lt;/li&gt;&lt;ol&gt;&lt;li&gt;bcel.jar (Byte Code Engineering Library used to change bytecode for the class)&lt;/li&gt;&lt;li&gt;jibx-bind.jar (1,2 are used in phase I)&lt;/li&gt;&lt;li&gt;jibx-run.jar&lt;/li&gt;&lt;li&gt;jibx-extras.jar&lt;/li&gt;&lt;li&gt;xpp3.jar (3,4,5 are used in phase II)&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Modify java class using binding compiler (java -jar ../lib/jibx-bind.jar binding.xml)&lt;/li&gt;&lt;li&gt;Write code for marshalling and unmarshalling of java object&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public void XML2Java2XML() {&lt;br /&gt;  try {&lt;br /&gt;   IBindingFactory bfact = BindingDirectory.getFactory(Customer.class);   &lt;br /&gt;   IUnmarshallingContext uctx = bfact.createUnmarshallingContext();&lt;br /&gt;&lt;br /&gt;   Object obj = uctx.unmarshalDocument&lt;br /&gt;        (new FileInputStream("customer.xml"), null);&lt;br /&gt;   Customer customer = (Customer)obj;&lt;br /&gt;   System.out.print(customer.toString());&lt;br /&gt;   &lt;br /&gt;   IMarshallingContext mctx = bfact.createMarshallingContext();&lt;br /&gt;      mctx.setIndent(4);&lt;br /&gt;      mctx.marshalDocument(obj, "UTF-8", null,&lt;br /&gt;          new FileOutputStream("customer2.xml"));&lt;br /&gt;      &lt;br /&gt;  } catch (FileNotFoundException e) {   &lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } catch (JiBXException e) { &lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-4767644351666319937?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/4767644351666319937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=4767644351666319937' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/4767644351666319937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/4767644351666319937'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2008/03/xml-binding-using-jibx.html' title='XML binding using JiBX'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-1733434077188525402</id><published>2008-03-26T08:26:00.000+05:30</published><updated>2008-03-26T08:32:50.392+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='password meter'/><category scheme='http://www.blogger.com/atom/ns#' term='password strength'/><title type='text'>Password Strength Meter</title><content type='html'>Almost every web site provides password strength meter.&lt;br /&gt;To make a strong password it should contain:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Sufficient length&lt;/li&gt;&lt;li&gt;Mixed case&lt;/li&gt;&lt;li&gt;Combination of numbers and Special characters&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;My password strength meter works on same line:&lt;/p&gt;&lt;p&gt;If password is of minimum length and same case it is a weak passwd&lt;/p&gt;&lt;p&gt;If password is min length mixed case and number normal passwd&lt;/p&gt;&lt;p&gt;if password is min length mixed case number and special char it is medium password&lt;/p&gt;&lt;p&gt;if password is above min length and combination of number and special char, it is strong passwd&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-1733434077188525402?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/1733434077188525402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=1733434077188525402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/1733434077188525402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/1733434077188525402'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2008/03/password-strength-meter.html' title='Password Strength Meter'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-5543040584904512416</id><published>2007-11-29T15:07:00.000+05:30</published><updated>2007-11-29T16:04:33.429+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='validator'/><category scheme='http://www.blogger.com/atom/ns#' term='modules'/><category scheme='http://www.blogger.com/atom/ns#' term='custom validator'/><category scheme='http://www.blogger.com/atom/ns#' term='struts validation'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='commons'/><category scheme='http://www.blogger.com/atom/ns#' term='validation'/><title type='text'>Client Side Validation</title><content type='html'>Validation is a very important aspect of any web application.We can validate user input in client side as well as server side. Client side validation is important since we dont want to send data to server and thenlet user know about the errors. But we can not rely only on client side validation since if Javascript is disabled on client side it will lead to invalid data on server.&lt;br /&gt;So mix approach should be followed: validating data on server as well as client side.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I am using Spring Framework and Spring MVC, I have few options available:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;AJAX based validation&lt;/li&gt;&lt;li&gt;Spring VLANG Validation&lt;/li&gt;&lt;li&gt;Apache commons validation (Struts Validator Framework)&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;I have dropped idea of AJAX based validation since it will require to more Remote calls&lt;br /&gt;Spring VLANG Validation is a good option but dependency is JDK 1.5 and we are still running on JDK 1.4.&lt;br /&gt;&lt;br /&gt;Finally decided to go for Commons validator this is well proven and stable one.&lt;br /&gt;I have also read &lt;a href="http://www.jroller.com/raible/entry/commons_validator_support_for_spring"&gt;blog&lt;/a&gt; from Matt where he appreciated commons validator.&lt;br /&gt;I have used custom validation along with commons standard validation.&lt;br /&gt;&lt;br /&gt;Steps followed by me to get commons validator configured with Spring are as follows:&lt;br /&gt;Dependency:&lt;br /&gt;1. &lt;a href="https://springmodules.dev.java.net/docs/reference/0.8/html_single/"&gt;Spring-commons-validator&lt;/a&gt; (Spring modules 0.8)&lt;br /&gt;2. &lt;a href="http://commons.apache.org/validator/"&gt;Commons validator&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Step 1: Downloaded dependency jar files&lt;br /&gt;Step 2: Added validation.xml, validation-rules.xml, validation-custom-rules.xml (For custom validators)&lt;br /&gt;Step 3: Added validation specific entries to applicationContext-validation.xml&lt;br /&gt;step 4: Added validator property to form controller entry in [context-root]-servlet.xml&lt;br /&gt;&lt;br /&gt;My Validation.xml is as follows:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Validation.xml&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&amp;lt;!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN" "&lt;a href="http://jakarta.apache.org/commons/dtds/validator_1_1.dtd"&gt;http://jakarta.apache.org/commons/dtds/validator_1_1.dtd&lt;/a&gt;;&lt;br /&gt;&amp;lt;form-validation&amp;gt;&lt;br /&gt;&amp;lt;formset&amp;gt;&lt;br /&gt;&amp;lt;form name="registerFormBean"&amp;gt;&lt;br /&gt;&amp;lt;field property="user.fname" depends="mask,maxlength"&amp;gt;&lt;br /&gt;&amp;lt;arg0 key="register.label.firstname"/&amp;gt;&lt;br /&gt;&amp;lt;arg1 name="maxlength" key="${var:maxlength}" resource="false"/&amp;gt; &amp;lt;var&amp;gt;&amp;lt;var-name&amp;gt;maxlength&amp;lt;/var-name&amp;gt;&amp;lt;var-value&amp;gt;5&amp;lt;/var-value&amp;gt;&lt;br /&gt;&amp;lt;/var&amp;gt; &amp;lt;var&amp;gt; &amp;lt;var-name&amp;gt;mask&amp;lt;/var-name&amp;gt; &amp;lt;var-value&amp;gt;^[a-zA-Z]*$&amp;lt;/var-value&amp;gt; &amp;lt;/var&amp;gt;&lt;br /&gt;&amp;lt;/field&amp;gt; &amp;lt;field property="user.email" depends="required,email"&amp;gt;&lt;br /&gt;&amp;lt;arg0 key="register.label.email"/&amp;gt;&lt;br /&gt;&amp;lt;/field&amp;gt; &amp;lt;&lt;br /&gt;field property="user.password" depends="required,twofields"&amp;gt;&lt;br /&gt;&amp;lt;arg0 key="register.label.password" /&amp;gt;&lt;br /&gt;&amp;lt;arg1 key="register.label.verifypassword"/&amp;gt;&lt;br /&gt;&amp;lt;var&amp;gt; &amp;lt;var-name&amp;gt;secondProperty&amp;lt;/var-name&amp;gt;&lt;br /&gt;&amp;lt;var-value&amp;gt;verifyPasswd&amp;lt;/var-value&amp;gt;&lt;br /&gt;&amp;lt;/var&amp;gt; &amp;lt;/field&amp;gt; &amp;lt;&lt;br /&gt;field property="verifyPasswd" depends="required"&amp;gt;&lt;br /&gt;&amp;lt;arg0 key="register.label.verifypassword" /&amp;gt;&lt;br /&gt;&amp;lt;/field&amp;gt;&lt;br /&gt;&amp;lt;field property="user.location" depends="selectfield"&amp;gt;&lt;br /&gt;&amp;lt;arg0 key="register.label.location" /&amp;gt;&lt;br /&gt;&amp;lt;arg1 key="${var:maxsize}" name="selectfield" resource="false"/&amp;gt;&lt;br /&gt;&amp;lt;var&amp;gt;&amp;lt;var-name&amp;gt;maxsize&amp;lt;/var-name&amp;gt;&amp;lt;var-value&amp;gt;3&amp;lt;/var-value&amp;gt;&amp;lt;/var&amp;gt;&lt;br /&gt;&amp;lt;/field&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/formset&amp;gt;&lt;br /&gt;&amp;lt;/form-validation&amp;gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Validation-rules-custom&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;My custom validation rules file is as follows:&lt;/p&gt;&lt;p&gt;&amp;lt;!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.3.0//EN" "&lt;a href="http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd"&gt;http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd&lt;/a&gt;; &amp;lt;form-validation&amp;gt;&lt;br /&gt;&amp;lt;global&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;lt;validator name="twofields" classname="com.tj.cand.utils.ValidationUtil" method="validateTwoFields" &lt;/p&gt;&lt;p&gt;methodParams="java.lang.Object, &lt;/p&gt;&lt;p&gt;org.apache.commons.validator.ValidatorAction, &lt;/p&gt;&lt;p&gt;org.apache.commons.validator.Field, &lt;/p&gt;&lt;p&gt;org.springframework.validation.Errors" &lt;/p&gt;&lt;p&gt;depends="required" msg="errors.twofields"&amp;gt; &lt;/p&gt;&lt;p&gt;&amp;lt;javascript&amp;gt;&amp;lt;!&lt;/p&gt;&lt;p&gt;[CDATA[ function validateTwoFields(form) { &lt;/p&gt;&lt;p&gt;var bValid = true; &lt;/p&gt;&lt;p&gt;var focusField = null;&lt;/p&gt;&lt;p&gt; var i = 0; &lt;/p&gt;&lt;p&gt;var fields = new Array(); &lt;/p&gt;&lt;p&gt;oTwoFields = new twofields(); &lt;/p&gt;&lt;p&gt;for (x in oTwoFields) { &lt;/p&gt;&lt;p&gt;var field = form[oTwoFields[x][0]]; &lt;/p&gt;&lt;p&gt;var secondField = form[oTwoFields[x][2]("secondProperty")];&lt;/p&gt;&lt;p&gt; if (field.type == 'text' field.type == 'textarea' field.type == 'select-one' field.type == 'radio' field.type == 'password') { &lt;/p&gt;&lt;p&gt;var value; var secondValue; &lt;/p&gt;&lt;p&gt;// get field's value &lt;/p&gt;&lt;p&gt;if (field.type == "select-one") { var si = field.selectedIndex; value = field.options[si].value; secondValue = secondField.options[si].value; } else { value = field.value; secondValue = secondField.value; } if (value != secondValue) { if (i == 0) { focusField = field; } fields[i++] = oTwoFields[x][1]; bValid = false; } } } if (fields.length &amp;gt; 0) { focusField.focus(); alert(fields.join('\n')); } return bValid; }]]&amp;gt; &amp;lt;/javascript&amp;gt; &amp;lt;/validator&amp;gt; &amp;lt;validator name="selectfield" classname="com.tj.cand.utils.ValidationUtil" method="validateSelectField" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.springframework.validation.Errors" depends="" msg="errors.multiselect"&amp;gt; &amp;lt;javascript&amp;gt;&amp;lt;![CDATA[ function validateSelectField(form) { var bValid = true; var focusField = null; var i = 0; var fields = new Array(); oSelectFields = new selectfield(); for (x in oSelectFields) { var field = form[oSelectFields[x][0]]; if (field.type == 'select-multiple') { var iMax = parseInt(oSelectFields[x][2]("maxsize"));&lt;br /&gt;if ((field.options.length == 0) (field.options.length &amp;gt; iMax)) { if (i == 0) { focusField = field; } fields[i++] = oSelectFields[x][1]; bValid = false; } } } if (fields.length &amp;gt; 0) { focusField.focus(); alert(fields.join('\n')); } return bValid; }]]&amp;gt; &amp;lt;/javascript&amp;gt; &amp;lt;/validator&amp;gt; &amp;lt;/global&amp;gt;&lt;br /&gt;&amp;lt;/form-validation&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-5543040584904512416?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/5543040584904512416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=5543040584904512416' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/5543040584904512416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/5543040584904512416'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2007/11/client-side-validation.html' title='Client Side Validation'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-5688097791971067587</id><published>2007-11-16T14:31:00.000+05:30</published><updated>2007-11-16T14:58:39.397+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySql'/><category scheme='http://www.blogger.com/atom/ns#' term='DBD::MySql'/><category scheme='http://www.blogger.com/atom/ns#' term='DBD'/><title type='text'>Installing DBD::MySql</title><content type='html'>I had spent last two days trying to install DBD::MySql &lt;span style="font-size:85%;"&gt;&lt;em&gt;version-4.005 for mySql 5.1-22.0 rc.&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After a lot of permutation and combination finally able to get it done. I have seen a lot of discussion forums but not able to get the root cause of the problem finally I figured out that it was related with MySql Devel rpm and static linking of My sql Client Library.&lt;br /&gt;&lt;br /&gt;This is a known issue with DBD::MySql. It fails if you try linking MySql Client library Dynamically.&lt;br /&gt;&lt;br /&gt;The steps I followed after going through DBD::MySql documentation are as follows:&lt;br /&gt;&lt;br /&gt;1. Install Mysql-Client rpm&lt;br /&gt;2. Install MySql-Devel Library&lt;br /&gt;3. Install MySql Shared Libraries&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;MySQL-client-community-5.1.22-0.rhel&lt;/li&gt;&lt;li&gt;MySQL-devel-5.1.22-0.glibc23&lt;/li&gt;&lt;li&gt;MySQL-shared-compat-5.1.22-0.rhel4&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;Installing DBD::MySql&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;1. tar xvzf DBD-mysql-&lt;version&gt;.tar.gz &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;2. cd DBD-mysql-&lt;version&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;3. cp /usr/lib/mysql/*.a /tmp/mysql-static (to link libmysql.client.a statically)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;4. perl Makefile.PL --libs="-L/tmp/mysql-static -lmysqlclient" --testuser=user --testpassword=pass&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;5. make&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;6. make test&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;7. make install&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;All tests passed successfully.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://lists.mysql.com/perl/3518"&gt;MySql List&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://search.cpan.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html"&gt;DBD::MySql Install Doc&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-5688097791971067587?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/5688097791971067587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=5688097791971067587' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/5688097791971067587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/5688097791971067587'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2007/11/installing-dbdmysql.html' title='Installing DBD::MySql'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4861352563000674067.post-3517892353216170520</id><published>2007-11-14T18:15:00.000+05:30</published><updated>2007-11-29T15:49:37.408+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dwr'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript remoting'/><title type='text'>AJAXing with Spring using DWR</title><content type='html'>Recently I have an opportunity to work with Spring Framework. With Spring I have used following technologies:&lt;br /&gt;&lt;br /&gt;1. Spring MVC&lt;br /&gt;2. Ajax - DWR&lt;br /&gt;3. Hibernate&lt;br /&gt;4. Tiles&lt;br /&gt;5. Acegi Security&lt;br /&gt;&lt;br /&gt;It was really a nice experience working with Spring and other supporting technologies.&lt;br /&gt;&lt;br /&gt;I found a littlet bit problem in getting DWR 2.0 working with Spring 2.0.&lt;br /&gt;&lt;br /&gt;Approach that worked for me as follows:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Web.xml&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;web-app schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"&amp;gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;&amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;&amp;lt;context-param&amp;gt;&lt;br /&gt;&amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;&lt;br /&gt;&amp;lt;param-value&amp;gt;/WEB-INF/applicationContext*.xml&amp;lt;/param-value&amp;gt;&lt;br /&gt;&amp;lt;/context-param&amp;gt;&lt;br /&gt;&amp;lt;!-- Listner Config--&amp;gt;&lt;br /&gt;&amp;lt;listener&amp;gt;&lt;br /&gt;&amp;lt;listener-class&amp;gt;org.springframework.web.context.ContextLoaderListener&amp;lt;/listener-class&amp;gt;&lt;br /&gt;&amp;lt;/listener&amp;gt;&lt;br /&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;&amp;lt;url-pattern&amp;gt;*.html&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;&amp;lt;url-pattern&amp;gt;/dwr/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;!-- Ajax DWR config ends --&amp;gt;&lt;br /&gt;&amp;lt;session-config&amp;gt;&lt;br /&gt;&amp;lt;session-timeout&amp;gt;&lt;br /&gt;30&lt;br /&gt;&amp;lt;/session-timeout&amp;gt;&lt;br /&gt;&amp;lt;/session-config&amp;gt;&lt;br /&gt;&amp;lt;welcome-file-list&amp;gt;&lt;br /&gt;&amp;lt;welcome-file&amp;gt;&lt;br /&gt;index.jsp&lt;br /&gt;&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;&amp;lt;/welcome-file-list&amp;gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;2. Application-Context.xml&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;!-- DWR Configurations --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;dwr:controller id="dwrController" debug="true"/&amp;gt;&lt;br /&gt;&amp;lt;!-- Configure DWR handlers --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;bean id="dwrUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;property name="alwaysUseFullPath" value="true"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;property name="mappings"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;props&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;prop key="/dwr/**/*"&amp;gt;dwrController&amp;lt;/prop&amp;gt; &amp;lt;/props&amp;gt; &amp;lt;/property&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&amp;lt;!-- Configure Convertor --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;dwr:configuration&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;dwr:convert type="bean" class="com.app.domain.User" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/dwr:configuration&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&amp;lt;!-- Configure Ajax controller --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;bean id="ajaxController" class="com.app.controller.dwr.AjaxController"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;dwr:remote javascript="UserList"&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;dwr:include method="getUser"/&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;dwr:include method="updateUser"/&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/dwr:remote&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;property name="userDao" ref="userDao"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;3. JSP Page&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Add following lines to jsp page:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;script type='text/javascript' src='/spring/dwr/interface/UserList.js'&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;script type='text/javascript' src='/spring/dwr/engine.js'&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;script type='text/javascript' src='/spring/dwr/util.js'&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Define call back javascript function and attach that to some event&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;script type="text/javascript"&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;function editUser(id) { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;UserList.getUser(id,function(array){DWRUtil.setValue(fname,array.fname); }); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Finally deploy the application and restart the server and here is your DWR wroking...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;To test it you can use: &lt;a href="http://localhost:8080/spring/dwr/index.html"&gt;http://localhost:8080/spring/dwr/index.html&lt;/a&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://getahead.ltd.uk/dwr"&gt;DWR&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.nabble.com/Spring-2.0.6-+-DWR-2.0-tf4232621.html#a12807040"&gt;Nabble Users&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://internna.blogspot.com/"&gt;Internna&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4861352563000674067-3517892353216170520?l=j2eethrill.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://j2eethrill.blogspot.com/feeds/3517892353216170520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4861352563000674067&amp;postID=3517892353216170520' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/3517892353216170520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4861352563000674067/posts/default/3517892353216170520'/><link rel='alternate' type='text/html' href='http://j2eethrill.blogspot.com/2007/11/spring-framework.html' title='AJAXing with Spring using DWR'/><author><name>Ram Awasthi</name><uri>http://www.blogger.com/profile/16796538406853401928</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img1.orkut.com/images/medium/1192078168/87049397.jpg'/></author><thr:total>1</thr:total></entry></feed>
