From host model to Web Model
In the host model mode, GWT does not compile Java code into JavaScript, but directly runs Java bytecode in the gwt environment,
However, after the project is officially deployed, the Web model is used. How can we migrate data from the host model to the Web model?
First, you need to compile the Java code into JavaScript code.
Use the following command to compile the Java code into JavaScript code:
Java-CP "% ~ Dp0 \ SRC; % ~ Dp0 \ bin; % ~ Dp0 \ ../gwt-user.jar; % ~ Dp0 \ ../gwt-dev-windows.jar "com. Google. GWT. Dev. gwtcompiler-out" % ~ Dp0 \ www "% * COM. Google. GWT. sample. Hello. Hello
-CP: Specifies the source code directory, class directory, and gwt jar file path.
-Out: Specifies the output path of JavaScript code.
Com. Google. GWT. sample. Hello. Hello specifies the compiled module. Generally, the entry-point class in the GWT. xml file removes the content after the client.
When the amount of code is large, you need to specify the size of the memory used by Java, otherwise the memory will overflow.
Java-xmx512m-xms128m-CP "% ~ Dp0 \ SRC; % ~ Dp0 \ bin; % ~ Dp0 \ ../gwt-user.jar; % ~ Dp0 \ ../gwt-dev-windows.jar "com. Google. GWT. Dev. gwtcompiler-out" % ~ Dp0 \ www "% * COM. Google. GWT. sample. Hello. Hello
Then copy the compiled JavaScript code to the root directory of the web project, the same level of directory as the WEB-INF.
Finally, the servlet corresponding to the Service programming defined in the GWT. xml file is required.
<Servlet Path = '/Calendar' class = 'com. Google. GWT. sample. dynatable. server. schoolcalendarserviceimpl '/>
=>
<Servlet>
<Servlet-Name> calendar </servlet-Name>
<Servlet-class> com. Google. GWT. sample. dynatable. server. schoolcalendarserviceimpl </servlet-class>
</Servlet>
<Servlet-mapping>
<Servlet-Name> calendar </servlet-Name>
<URL-pattern>/Calendar </url-pattern>
</Servlet-mapping>
From: http://beckham-xiao.iteye.com/blog/372338