aspose file tools*
The moose likes GWT and the fly likes GWT in Action:Qurie about Java Script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "GWT in Action:Qurie about Java Script" Watch "GWT in Action:Qurie about Java Script" New topic
Author

GWT in Action:Qurie about Java Script

NDP Prasad
Ranch Hand

Joined: Apr 13, 2006
Posts: 177
Do i need JavaScript or Ajax Knowledge to implement Ajax using GWT?


SCJP,SCWCD<br />
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9622
    
    2

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!


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
NDP Prasad
Ranch Hand

Joined: Apr 13, 2006
Posts: 177
where do we use the GWT?

In java class or servlet or jsp?
Adam Tacy
author
Ranch Hand

Joined: Jun 02, 2007
Posts: 37
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

Joined: Jun 02, 2007
Posts: 37
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

Joined: Apr 13, 2006
Posts: 177
Thank you for your Elaborate Reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GWT in Action:Qurie about Java Script