GWT from host model to Web Model

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.