• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GWT in Action:Qurie about Java Script

 
NDP Prasad
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do i need JavaScript or Ajax Knowledge to implement Ajax using GWT?
 
Joe Harry
Ranch Hand
Posts: 10109
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No...the cool thing about GWT is that if you just know java, it is more than enough. All the javascript is auto generated from the java class that you write. This is what amazes me about GWT!
 
NDP Prasad
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where do we use the GWT?

In java class or servlet or jsp?
 
Adam Tacy
author
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

In theory, no you don't need to know any JavaScript at all to create a GWT application.

With regards to AJAX, as long as you grab the concept that the communication between client and server is asynchronous then that should be enough to get creating with GWT.

It is though useful to always keep in mind that the output of GWT compilation, for the client side, is a pure JavaScript representation of you program. This means that your client side code has to play by exactly the same rules as any other JavaScript application - i.e. no database access, no client side file I/O write access, same origin security restrictions etc.

If you need db access then you place this on the server (using either GWT RPC mechanism or any one of your favourite server side languages).

You can of course interact with any JavaScript library you already have using GWT's JavaScript Native Interface (JSNI) which effectively mimics JNI in normal Java to provide access to JavaScript code. If you do so, then a bit more knowledge of JavaScript is necessary.

But, as said at the top, if you don't know JavaScript then that is not a handicap to developing GWT applications.

Hope that helps!

//Adam
 
Adam Tacy
author
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer your second post I'll explain a little on what happens with your application if you are going straight to producing code for your web server.

First, you write the code in Java (or at least those aspects of Java currently supported - 1.4 syntax and most of java.lang and java.util - 1.5 syntax is hopefully coming in the next release).

Then you would fire up GWT's compiler, which produces a number of JavaScript permutations of your code. Each permutation covers the various browser nuances and differences.

The compiler also produces a small segment of bootstrap code - it is this code that you load into your web page, which then selects the appropriate JavaScript permutation for the browser (and other conditions if you get more complicated).

So no, there is no Java class or servlet to use for pure client side code it is all stand alone.

If you start implementing server side code, then you are free to use whatever language / technology you want and you just deploy as normal. You can also use an approach called GWT RPC which allows you to write more knitted together code and this does require you to deploy a special servlet to your server to handle the commication/serialization etc but that is a trivial deployment.

//Adam
 
NDP Prasad
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your Elaborate Reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic