Scared of writing AJAX code?
Are you a Java developer with no prior scripting experience but still have to write AJAX based applications?
Here comes GWT for your rescue!!!! Google™ has launched the Google Web Toolkit (Beta) and is looking forward to receive feedback from the developer community. You can download it here, and give a try.
Heres a summary of why you should use GWT.
Steps to create an Eclipse based GWT application:
From the extracted directories of the downloaded archive, locate the utility files by name projectCreator and applicationCreator(located in the root directory and you can also put this directory onto your path). These utility can generate the necessary files that are required for a perfect project structure in Eclipse.
Note that you need to import the contents of the generated folder into Eclipse using the Import –> Existing Project into Workspace option.
Run the HelloWorldApplication-compile.cmd script and you can see that a folder www gets generated which has the html files and the script files containing AJAX code.
I modified the standard generated code a bit to make it accept the user name as input and the output says Hello to the user and tells at what time on the server the user has visited this page…again…ALL ASYNCHRONOUSLY!!! That’s the magic of AJAX!!!
Find below the code for reference:
This was all about writing and running the code on your local machine / test environment and won’t do any good for your realtime scenario. What when you want to point your AJAX enabled pages to a server side implementation, say a J2EE Web Application? The answer is GWT RPC framework. You still generate your AJAX code using GWT tools and point them to the server side implementation using RPC.