I have been following the example's in Ed Burnette's E-book "Google Web Toolkit - Taking the pain out of Ajax." When I got to section 5.4 on GWT RPC basics, I created a new project using the GWT command line scripts projectCreator and applicationCreator, creating an Eclipse project. I imported the project into Eclipse, created all the files in the example and it ran as expected.
Then I created a GWT Designer project from Eclipse. I created the module using Designer's built-in module creation functionality. Everything seemed to go well, until I tried to run the project. It wouldn't work.
Ed's example uses a table in the HTML file that the GWT scripts create.
<table align=center>
<tr>
<td id="slot1"></td><td id="slot2"></td>
</tr>
</table>
In the EntryPoint java class, he uses the following to add a widget to the cells in the table based on ID.
Button button = new Button("Click Me");
RootPanel.get("slot1").add(button);
This functionality works fine in the GWT created project, but when I copy the table to the HTML file in the Designer project, the GWT code fails to find the DOM element with the ID "slot1." I get a NullPointerException on the RootPanel line.
I created the GWT project and the Designer project's again. This time, I didn't add any modules, I only copied the HTML table to the Designer project and added one line to the EntryPoint java class: RootPanel.get("slot1").add(button);
The GWT project worked, the Designer project fails.
According the the JavaDocs, this method should work as expected and as it works in the GWT project.
Any idea why it doesn't work in a Designer project?
Thanks!