Tuesday, September 29, 2015

How to create GWT module using Eclipse

1- Lets first create inbuild plugin GWT Project i.e. CreateGWTModule








2- Click on Project CreateGWTModule in project explore

2.1- Right Click on Project




2.2- Click on other - Go to Google Web tool kit and click on Module


2.3- Click next and fill the information



2.4- Click finish


our Module Project xml will be like below
<-- encoding="”UTF-8″?" version="”1.0″" xml="">
<--!DOCTYPE module PUBLIC “-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN” “http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd”&gt;
<--module>
<--inherits name=”com.google.gwt.user.User” />
<--source path=”client”/>
<--/module>
3- Our project will look like below




4- Create a java class

public class TestMyClass {
private String firstName;

public String getFirstName() {
return firstName;
}


public void setFirstName(String firstName) {
this.firstName = firstName;
}
}




5- In our project GWT make following line changes by importing the newly created project
@Override
public void onModuleLoad() {
TestMyClass p = new TestMyClass();
p.setFirstName("Lars");
Label label = new Label("Hello " + p.getFirstName());
RootPanel.get().add(label);
}

6- Run the project and see the result



No comments: