Santosh, I've run your code in Firefox & IE7, and it works perfectly fine - your code also looks good. Could it be that the location of dojo.js doesn't match your file system? When the page is loaded, look in Firebug to see if Dojo has bootstrapped - if so, an object named 'dojo' should have been created.
Greg, You are right I had to change the way I was using dojo.js location from src="js/dojo/dojo.js" to src="<%=request.getContextPath()%>/js/dojo/dojo.js" and it worked.
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads: