Setting up NetBeans 5.5 for Dojo AJAX Development
By jhawk on Nov 26, 2007
Inserting the Dojo Toolkit into NetBeans 5.5
1. Download the latest version of Dojo Toolkit
At the time I'm writing this, the toolkit is currently on version 1.0.1
2. Unpack the Packaging.
This will create a directory called “dojo-release-1.0.1”. Save this directory in a location which you will
use it later.
In my case, I'm copying this directory into my Development folder.
3. Start up NetBeans 5.5
4. Create a new Project.
File->New Project->Web->Web Application
and press the Next button.
5. Define the New Project.
Project Name: HelloDojo
You can leave the rest unless you need to save the project in another location.
Click the Finish Button.
6. Examining the Web Project's Directory Structure
NetBeans should display the following..
The Directory Structure Represents the two important directories: (we will ignore the rest for now)
a. Web Pages - The HTML, JSP, CSS and Image files. Also this contains XML files used by the Server.
b. Source Packages - Server-side Java Implementations (Servlets and Enterprise Beans)
7. Copy Dojo Toolkit into the Web Pages Directory
NetBeans will reflect this change. (highlighted below)
Congrads.. You are now ready to start your Dojo Development!
Writing your first Dojo Application
1. Setting up Dojo in your Page
This example has been taken directly from the “The Book of Dojo” section entitled Hello World - Dojo for the Attention-Impaired. Full credit should be given to “lance” who is the author. I'm adding to this example the NetBeans work we did in the previous section.
The first thing we will do is:
a. Load a Cascading Style-Sheet (CSS). We will be using “Tundra” from the Dijit theme library.
c. Place the “tundra” CSS class into the body tag
d. I changed the default “JSP Page” title to “HelloDojo Page”
2. Load the Required Widget/Modules
In this step, we will load the Button widget. (see “SECTION 2”)
3. Add the Widget to the HTML
Inside the BODY tag, place a new instance of the Button widget on the page.
At this time, you can actually try something out. Press the “Run Main Project” button to construct a WAR file to be installed on TomCat.
We now have a button. It doesn't do anything, but we have a button!
4. Add an Event to the Button
We are adding a specialized script tag in the above button to handle a mouse click event.
This mouse click will cause an Alert to Popup. If you run it, and click on the button, you should see the following..
This is it.. you have a very basic AJAX application working on NetBeans 5.5. Next week, I will show out the Server-side Java will provide more useful information than just a PopUp.
I hope you found this information useful. I will be continuing this series further to include our new AJAX-based Web Client (code named Kendo). Please stay tuned..