Skip to content

Instantly share code, notes, and snippets.

@YusukeKokubo
Created April 27, 2012 05:25
Show Gist options
  • Save YusukeKokubo/2506139 to your computer and use it in GitHub Desktop.
Save YusukeKokubo/2506139 to your computer and use it in GitHub Desktop.
Hello GwtQuery
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="hello">
<inherits name="com.google.gwt.user.User" />
<inherits name='com.google.gwt.query.Query' />
<source path="client" />
<entry-point class="as.client.Hello"></entry-point>
</module>
package as.client;
import static com.google.gwt.query.client.GQuery.$;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.query.client.Function;
import com.google.gwt.user.client.Event;
public class Hello implements EntryPoint {
@Override
public void onModuleLoad() {
$(".submit").click(new Function() {
@Override
public boolean f(Event e) {
$("label").text($(".name").val());
return true;
}
});
}
}
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>index</title>
<script type="text/javascript" language="javascript" src="hello/hello.nocache.js"></script>
</head>
<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<p>Hello: <label>hogehoge</label></p>
<input class="name" type="text" name="name" />
<button class="submit" type="submit">send</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment