Sunday, April 19, 2009

DOJO Tutorial

Dojo is a toolkit is an open source modular javaScript library. It used to ease the rapid development of Ajax based web application. First you have to download dojo.js from dojotoolkit.org .
1. Create one dynamic web project in Eclipse IDE. (Say Project Name Dojo_Demo)
2. Put the downloaded dojo.js into WebContent folder of project. (Location C:\DOJO_workspace\Dojo_Demo\WebContent\demo.jsp, here C:\DOJO_workspace is project path).
3. Create one demo.jsp in same locatoin i.e. WebContent

demo.jsp

<html>
<head>
<title>Binod Java Solution</title>
<script type="text/javascript">
dojo.require("dojo.event.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Button");
function buttonCheck() { alert('YOU PRESSED OK BUTTON'); }
function init() {
var helloButton = dojo.widget.byId('button_first');
dojo.event.connect(helloButton, 'onClick')
}
dojo.addOnLoad(init); </script>
</head>
<body bgcolor="#FFFFCC">
<p align="center"><font size="6" color="#800000">Welcome to http://binodsuman.blogspot.com</font></p>
<button dojoType="Button" widgetId="button_first" onClick="buttonCheck();">OK BUTTON</button>
<br>
</body>
</html>

Add any web server (like Tomcat5.5) to your project then add Dojo_Demo project to server and start the server
Run http://localhost:8080/Dojo_Demo/demo.jsp
You will get dojo button, click and get your result. ........ :) So simple
Please give your comment, if you have any idea to enhance this tutorial ........ :)

3 comments:

  1. HI Binod. why don't you put the screenshots of this example for eclipse ide

    ReplyDelete
  2. that's what dojo looks like? my buddy made it sound like coding in dojo would be about as hard as coding in straight binary... thanks for the quick tut

    ReplyDelete

You can put your comments here (Either feedback or your Question related to blog)