Hi all,
I'm a beginner to GWT. Something puzzled me then I'm trying to add a
new HTML file to the new created Eclipse project. I followed
"Beginning Google Web Toolkit" completely.
First I used the command:
applicationcreator -eclipse GWTasks -out GWTasks
com.apress.gwt.client.GWTasks
and
projectcreator -eclipse GWTasks -out GWTasks.
Then I import the whole project into Eclipse by "File->Import". It
runs good.
Third I add a new HTML file to the project, the file looks like:
<html>
<head>
<title>
<script type="text/javascript" language="javascript"
src="com.apress.gwt.UserRegistrationForm.nocache.js"></script>
</title>
</head>
<body>
<h1>User Registration Form</h1>
<table>
<tr>
<td id = "usernameLabel"></td>
<td id = "usernameField"></td>
</tr>
<tr>
<td id = "passwordLabel"></td>
<td id = "passwordField"></td>
</tr>
<tr>
<td id = "retryPasswordLabel"></td>
<td id = "retryPasswordField"></td>
</tr>
</table>
<div id = "submitButton"></div>
</body>
</html>
I copyed the file "GWTasks.html" generated by applicationcreator and
replace the <script> secsion. The file is put at gwtasks\src\com\apress
\gwt\public. I also add the corresponding java code file:
package com.apress.gwt.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
public class UserRegistrationForm implements EntryPoint
{
public void onModuleLoad()
{
final Label lblUsername = new Label("Username: ");
final TextBox tbUsername = new TextBox();
RootPanel.get("usernameLabel").add(lblUsername);
RootPanel.get("usernameField").add(tbUsername);
final Label lblPassword = new Label("Password: ");
final TextBox tbPassword = new TextBox();
RootPanel.get("passwordLabel").add(lblPassword);
RootPanel.get("passwordField").add(tbPassword);
final Label lblRetryPasswordLabel = new Label("Retry: ");
final TextBox tbRetryPasswordLabel = new TextBox();
RootPanel.get("retryPasswordLabel").add(lblRetryPasswordLabel);
RootPanel.get("retryPasswordField").add(tbRetryPasswordLabel);
final Button submitBtn = new Button("Regist");
submitBtn.addClickListener(new ClickListener()
{
public void onClick(Widget sender)
{
AccountInfo ai = new AccountInfo();
ai.setFullname(tbUsername.getText());
ai.setPassword(tbPassword.getText());
register(ai);
}
});
RootPanel.get("submitButton").add(submitBtn);
}
protected void register(AccountInfo ai)
{
Window.alert(ai.toString());
}
}
But when I run this project in Eclipse by click the green run
button, Nothing was Shown! Then I run "GWTask-comile.cmd" and compiled
the whole project. I found no
"com.apress.gwt.UserRegistrationForm.nocache.js" file. I guessed that
the "UserRegistrationForm.java" wasn't compiled.
Soon I copyed "GWTasks.gwt.xml" and renamed it to
"UserRegistrationForm.gwt.xml", replace the old EntryPoint to
UserRegistrationForm. But it doesn't work.
I'm so puzzle, I don't know what's wrong. Can anyone point out what
the mistakes I made?
Thank everyone!
PS: My English is so poor that there must be many silly mistakes.
Please point it out if you would, Thanks again.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---