There has been few drastic changes made in GWT 1.6 . The most important one is the new project structure. GWT now uses a “war” directory for most public resource and server configuration files. For the total change list, visit this page.
My previous post “Getting Started With the GWT “ was fine for the previous version(1.5.*) of GWT. But, since things are not the same now, I am writing another tutorial for the new version of GWT. It is also applicable for GWT 1.7 or later.
- At first, download the latest build of GWT from here.
- Unzip it to any location in your Hard drive.
- Now, add the Google Plugin in your Eclipse IDE. You can follow my previous blog.
- Now choose File>New>Web Application Project. Or, you can click the “New Web Application Project” button from the newly added Google Toolbar.
- Give a project name and package structure. Leave other options as default.
- After finishing the “New Web Application” wizard, a default template GWT project would be created according to your given name.
- You’ll get a nice starting project after that. Moreover, you’ll get an RPC communication mechanism as default in this project. If you look at the project structure, you’ll find 3 files GreetingService.java, GreetingServiceAsync.java, GreetingServiceImpl.java in the project. This three files would be used if you need Server-Client communication.
- Now, if you want to develop a web app that will not need any server communication, you have to delete some stuffs from the project.
- Delete those three files. GreetingService.java and GreetingServiceAsync.java are located in your client package. And, GreetingServiceImpl.java is located in the server package.
- Open the “web.xml” file from the “war -> WEB-INF”.
- Delete texts starting form “” to ““. This portion of xml code is used for the server side servlet mapping.
Now you can write a web app that doesn’t use server-client communications.
If you want to deploy your application in the Google App Engine, follow these steps:
- Sign up in Google App engine
- Then sign in with your account.
- Then click on the “Create an application” button.
- Give a application ID and title of your app and click “save”.
- Your application is created.
- Now go back to Eclipse. Right click on the project from the “package explorer” tab.
- Select “Deploy to App Engine” from the “Google” sub-menu.
- Choose the “App Engine Project Settings” from the dialog.
- Give the Application ID (It is the app ID you have created earlier) and the version number. Click ok.
- Then give your email (Google id) and password, click Deploy.
- Your project would be compiled and deployed to the Google App Engine.
And, that’s all. You would be able to run your web app from the “http://xyz.appspot.com”, where xyz stands for your application ID.
No comments:
Post a Comment