开发者

How do I structure a GWT project?

I have followed the basic GWT tutorial for creating a project in Eclipse. Now, I am trying to build off what I learned in the tutorial. I created a static utility class to perform some database connection logic. However, when I try t开发者_如何转开发o compile I get:

[ERROR] Line 46: No source code is available for type com.sample.server.ConnectionUtil; did you forget to inherit a required module?

Where can I put simple classes that I've created on my own? Do they have to be outside the package structure of the basic module, 'com.sample'? Or do I have to specify a whole new module in the gwt.xml file and inherit from that? There has to be something simple I'm missing.


Required reading: http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html. That is, you should really really read it after reading this answer.

Check your module file – it has the extension .gwt.xml. You'll see a tag called entry-point. Any code that you add to your project that you want to run on the client side should be in that package or a subpackage.

For example, my entry point is com.wesley.heapunderflow.client.HeapUnderflow. All my translatable code should be in com.wesley.heapunderflow.client or a subpackage.

If you really need to add another package, add a <source path="package"/> declaration, where package is something like com.wesley.heapunderflow.tools or com.wesley.skynet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜