use in my GWT 1.6 application, both the client-server-side code as well as the same business model classes. These classes are, however, in another Eclipse project and are therefore not simply in my with the Google plugin Eclipse GWT project creator available. To ensure that everything runs smoothly following configurations are required:
Eclipse configuration Simple: 'As always' expand in the Project Properties Java Build Path
the project, in which the business model is developed (ie, extend the CLASSPATH). Then you can be in the client-and server-side programming GWT ever use the appropriate classes in Eclipse.Hosted Modesgeneration of client-side code
The most in my view, best GWT, namely the translation of JavaScript code from Java code, provides a small complication: The GWT compiler needs for all classes referenced in the client program source code. Without any JS code conversion, and therefore no client application. One finds in the error output of
entries like the following, not as long as the business model classes are available:
[ERROR] Line 21: No source code is available for type xyzmodell.KlasseXY, did you forget to inherit a required module?
Similar messages you get when you recompile the project in Eclipse:
Compiling module xyzGWTProj Refresher module from source       Validating newly compiled units          Removing units with errors             [ERROR] Errors in 'file:/…/GWTProj/src/x/y/z/client/Modell.java'                [ERROR] Line 5: The import can not be resolved xyz.modell.KlasseXY ... ..
[ERROR] Line 40: Missing code implementation in the compilertake a module in the description of the XML filesThe reference in the error message on a missing
inherit
. Actually I was hoping that it would at least in the case of classes that are not widgets not be necessary my entire business model with special
The business model is packaged in org.xy.smod . In this package, I create the new module XML file SMod.gwt.xml
\u0026lt;? Xml version = "1.0" encoding = "UTF-8"?> ! \u0026lt;DOCTYPE module PUBLIC "- / / Google Inc. / / DTD Google Web Toolkit 1.6.4 / / EN" "
http://google-web-toolkit.googlecode.com/svn/tags/ 1.6.4/distro-source/core/src/gwt-module.dtd ">
\u0026lt;module rename-to='smod'>
\u0026lt;source path =" " />
.\u0026lt;/ module>
So I put a new 'module' in the name
smod
. The sourcestatement is necessary so that all classes are directly involved in the package. Otherwise, the file is empty. In particular, not the usual GWT modules such
com.google.gwt.user.Userbe involved, including of course there are no entry-point
Now I have in the module XML file of my actual application only inherit include this module . The following line is added: ... \u0026lt;inherits name='org.xy.smod.SMod'/>
...We're done! At least in my area of the GWT compiler will now find the source code of the business model classes that are in another Eclipse project, and can be used to compile as well as the launch in hosted mode to perform successfully.
Note: A good description of the GWT compiler in general can be found in the internet freely available section "Understand the GWT compiler 'from the book
GWT in Practice . test the server-side programming / deployment in the web server
Once you want to test the server-side programming and installing the application WARs in the production server RPC servlets also have the business model classes are available. As this again is a pure Java byte code, only the matter is, for example in the form of a corresponding JARs necessary. The jar, you simply put 'whatever' in
/ WEB-INF/lib / and is ready.
0 comments:
Post a Comment