0

我是 GWT 开发的新手,我只是在修改一个之前运行良好的 GWT 项目,

在eclipse开发环境下,它运行良好,直到服务器端需要一个上下文参数,该参数应该在servlt为initcontent()时启动。

因此,我必须编译项目,然后打包它们并将它们部署到独立的 jboss 上。它现在在 jboss 下不起作用。

如果它是一个常见的 Web 应用程序,我倾向于在网页中添加“window.alert("")”,并跟踪错误发生的位置以及上下文是什么,但是,在 gwt 中,我不知道该怎么做像那些,我添加了gwt`s Window.alert(),它不起作用,我尝试从firebug那里获得帮助,但我只是找到了一些由gwt生成的无名函数,我不知道java中的哪些对象是与那些名字协调?

一些老练的家伙能给我一些关于他们的经验吗?


实际上,在我的 Gwt 代码中,我需要向 Web 服务请求一个 REST 请求,当我在 dev 模块中调试 GWT 时,客户端部分运行良好(即那些用 GWT 编写的代码),但服务器端是错误的 - 开发模块没有执行 servlet initcontext()——我的网络服务器需要它。

因此,我不得不将我的整个项目部署到一个独立的 jboss,现在,我被卡住了,我不知道哪里错了。也许另一个想法是让我的客户端请求“远程”服务器(现在它的请求看起来像连接到本地)我担心这个想法是否失败,即我的代码在开发模块中很好,并且在产品模块中出现错误,我怎么能在我的 gwt 代码中添加一些代码,如带有 JavaScript 的 window.alert() 以帮助我调试。谢谢你们教我如何在eclipse中调试GWT,我更想知道如何通过插入js代码来调试它。

4

3 回答 3

1

As of GWT 2.8 the primary way to run a GWT App in development environment is by using the "super dev mode" or "code server". this mode compiles the code and runs the JS code in the browser. The old versions before 2.8 had the "dev mode" that used a browser plugin to communicate with the JVM running the webapp in dev mode.

For GWT 2.8 you want to use the dev tools in your browser or a IDE Plugin like https://sdbg.github.io/ (works with chrome only - afaik) which allows you to do most of the debugging in eclipse.


OLD ANSWER

In Eclipse right click on the project and then got to "Debug as" > "Web application".

This way you can debug your GWT App like any other Java Application.

If you need more information on how to use the Java debugging features in Eclipse you may want to look here http://www.vogella.com/articles/EclipseDebugging/article.html

Good luck

于 2013-06-25T10:35:50.390 回答
0

您需要在代码上设置断点并单击 Debug 下拉菜单,然后单击 GWT Application。(在某些情况下,您的应用程序名称也会显示在下拉列表中。您可以单击它。)

于 2013-06-25T11:10:36.360 回答
0

您可以使用已部署的服务器端代码(您也可以远程调试,但这是另一回事)从部署的服务器以 DevMode 运行客户端代码:http: //www.gwtproject.org/doc/latest/DevGuideCompilingAndDebugging。 html#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT%27s

于 2013-06-25T11:30:06.950 回答