Amir
Amir

Reputation: 351

what class convert to java script in GWT?

i create a sample project with GWT. in my project there are some classes and packages. my question is that what class or package finally convert to java script? server? client? or both? and what is server roll in project?

Upvotes: 1

Views: 383

Answers (2)

Blessed Geek
Blessed Geek

Reputation: 21654

What java source code gets compiled into javascript is specified in your module definition gwt.xml file.

<module>
  <inherits name="com.google.gwt.user.User" />
  <source path="async"/>
  <source path="dto" includes="Employee.java, Address.java"/>
  <source path="shared" excludes="Calendar.java"/>
</module>

In the above module definition gwt.xml file, only the following are compiled into javascript

  • the folder async
  • the classes Employee.java, Address.java in the folder dto
  • all the classes in folder shared, except the class Calender
  • as well as the classes defined in gwt-user.jar:/com/google/gwt/user/User.gwt.xml

They do not have to involve "client", "server" or "shared", which are simply suggested names of folders to be used.

Whatever else folders not specified in the module gwt.xml file will be only used as server-side.

All the sources/resouces/classes specified inside the gwt.xml file will also be available fo server-side use.

Upvotes: 5

mariosk89
mariosk89

Reputation: 954

code inside the "client" part is translated into Javascript. code inside the "server" part is pure java and runs on the server side.

Upvotes: 0

Related Questions