0

I am getting this module 'tdlat.AllTasks' may need to be (re)compiled, when I link from my home page (ToDoList.html) to my 'AllTasks' page (AllTasks.html). But when I run directly from the AllTasks page I do not get this error. I am running this in Development Mode.

FILES PACKAGE
enter image description here

Error

Code where the URL links to the error

Anchor link = new Anchor(true);
horizontalPanel_1.add(link);
link.setHTML("All Tasks");
link.setHref("AllTasks.html");

My link is linked to a separate module.

EDIT

link.setHref("AllTasks.html?gwt.codesvr=127.0.0.1:9997")

Fixed my problem, but I am not too sure how to make this work also in production mode. Here is what I have so far.

if (GWT.isProdMode()){
    // What goes here? Thanks!      
}
else
{
    link.setHref("AllTasks.html?gwt.codesvr=127.0.0.1:9997");
}

Thank you for the assistance! Please let me know if there is any confusion.

4

1 回答 1

2

In development mode, you need to append the parameter gwt.codesvr. So, you can use

if(GWT.isProdMode()) {
   link.setHref("AllTasks.html");
} else {
   link.setHref("AllTasks.html?gwt.codesvr=127.0.0.1:9997");
}

GWT.isProdMode() returns true in production mode and false when in development mode (127.0.0.1:8888) and is optimized by the GWT compiler, so everything in the else doesn't show up in the resulting JavaScript code, as if you just wrote link.setHref("AllTasks.html"). It is a neat tool for all kind of analyzing things in DevMode, without slowing down the production system.

于 2013-04-23T17:21:14.723 回答