Thursday, June 24, 2010

Short Introduction GWT (Google Web ToolKit)

GWT:

In last couple of months, i am working on GWT (Google Web ToolKit). I am not great fan of this techonology because i got too many problems.

It uses well-known Remote Procedure Call (RPC) principles implemented by a generic servlet (RemoteServiceServlet), which you can specialize for your own needs. You also can use JavaScript Object Notation (JSON) as the data interchange format for your HTTP messages sent with the GWT HTTPRequest class.
Way of creating the application.
1)One way just install GWTSDK and create application by using following command
webappcreator -out projectname packagename.projectname
It creates structure similar to web applciation.
src:
--packagename.projectname.gwt.xml(This file contains information about entry point and inherited modules)
--packagename.client
--projectname.java (By default this is entry class and it runs while we run this applciation.)
--GreetingServiceAsync.java ( An interface with methods)
--GreetingService.java ( An interface which extends RemoteService)
--packagename.server
--GreetingServiceImpl (extends RemoteServiceServlet implements GreetingService )
This class overrides the methods of GreetingService
war:
--WEB-INF (with classes, lib folders and web.xml (similar to normal j2ee web application))
--projectname.html and .css
--build.xml (for detais of build.xml read ANT in detail)

In next post,I would like to discuss these files in detail
Now import this project to eclipse workspace ,build required jar (all required jar --inside bin of GWT folder or parallel to webappcreator) and run as JAVA Application (Hosted Mode)

2) Second way install plugin for GWT on eclipse. You will get 3 icons. One blue button ('g' is written on it) and other with red ('G' is written)and etc
Now just click on blue button and you got screen where you write project name and package name. (Uncheck Google App Engine for Now)
You project hasbeen created. If you want to use extra jar ,then build them.Some extra folders are created like test and test classes ,shared etc. Rest similar to above.



Problem: Less control over the client-side code of your application because it’s eventually generated by the GWT compiler.GWT provides a compiler that translates the Java code on the client side into JavaScript and DHTML.So you can use only few JAVA API's (lan and util).

Personally i got these error:
1)When i create war file, i am not able to create it properly while in normal web application i can create easily. (according to me This error is not because of GWT, but little bit tough for me..:( ) I am still with this error.
2)On changing platforms (Windows to linux and vice-versa), some functions doesn't support. So it requires extra time.

Maybe i am new of this tecgonology that's why i am getting these problem or it has.
But it creates good application where i want to use AJAX. Much dynamic site and better look can be created using this techonology.

Jar Needed for it:
gwt-dev-windows.jar or gwt-dev-linux.jar: Programming tools including the compiler. The embedded Web browser provided by GWT is platform-dependent.
gwt-user.jar: The GWT runtime.
gwt-servlet.jar: The jar to deploy on your application server with the code generated by the GWT compiler. It contains the RemoteServiceServlet.

Any suggestion or solution of problem. Plz tell me.

Thanks!!

No comments:

Post a Comment