Actually, its nothing to do with the Java language explicitly. GWT is cleverly organized to make it quick and comparatively easy to build sophisticated Ajax apps without having to get too much into the details of Javascript.

In a GWT project the GWT compiler cross-compiles a subset of the Java language to Javascript for downloading to the client browser. You have to tell it which classes to cross-compile and so the GWT project layout by convention has three separate sub-packages whose names end with 'client', 'server', 'shared'. You can also add sub-packages to these.

'client' and 'shared' packages are both compiled by the JRE for use in hosted mode, AND cross-compiled by GWT for use in production mode. 'client' is for code ONLY used in the client. 'shared' is for code (typically DTOs, or validation objects) which are used on both client and server.

You should put classes which are server side only in x.x.x.server or sub packages. Then you should make sure that the classpath includes any libraries used by these packages by placing the libraries in the war/WEB-INF/lib folder and make sure that the JRE looks there.

The exact configuration can be controlled from within a gwt.xml file.

I suggest that you read the http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html section.
See also the sections on Modules and Compile and Debug.

Be warned! There's a learning curve in using Java, a STEEP learning curve in using Java in web projects and another significant learning curve to using GWT for client/server web applications. I suggest that you think carefully about the scope and requirements of your application before
taking these 3 steps. Good luck!

HTH

Alan



m wrote:
Sorry, I'm a c# transplant. I want a create a class that will be used
on server side only. In c# I would just create a new class in the
project... learning that java doesn't work that way.  I have created a
class within the main package of my GWT project (not client, not
server, not shared, the main package).  But I don't think this works.
It wants to find a .gwt.xml file for this java class.  So... what is
the correct way to do this?  Thanks.


--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to