Building AJAX applications with Google Web Toolkit, Apache Derby, and Eclipse 4

Source: Internet
Author: User
Tags tomcat apache tomcat

This article will use Apache Tomcat as the sample servlet container because it is widely available and free of charge. Other servlet containers behave similarly. Typically, it will be deployed to an existing server, but if not, the links in the Resources section at the end of this article will tell you where to download Tomcat. If you are running the microsoft®windows® operating system, Tomcat has a relatively easy-to-use Windows-oriented binary installer. If it is on a Mac or UNIX® system, there is a compiled version that can be extracted and placed in a convenient location (usually/usr/local), and you can continue to learn after setting up some environment variables.

Edit client Code

Broadly speaking, there are two steps to deploying a GWT application in Tomcat:

Collect all the necessary files and place them in a location that Tomcat can view.

Make Tomcat aware of all server-side operations that are invoked from the GWT page.

The process is a few steps ahead of the assumption, and there is no official way to automate these steps by the time this article is finalized. I describe the manual process here. However, when you read this article, there may already be more robust tools to support deployment.

Navigate to Tomcat's installation root directory. In the next level of the directory, you will see a subdirectory named WebApps. Each application running within the Tomcat servlet container will get a directory of the application itself from there. Therefore, a directory named SLICR is created within the WebApps. The structure of the Java server-side application is set in accordance with the servlet standard, and all servlet running programs should support the same structure.

In the SLICR directory, create a subdirectory named Web-inf-yes, make sure to capitalize.

Move the GWT-compiled JavaScript page and the normal compiled Java class to the SLICR directory. I'll show you how to create Java classes first.

Compile Java code normally using the Integrated development environment (IDE), Apache Ant, or the tool you want to use. There are many choices at this time:

The quickest option is to copy the entire. class file tree to the Tomcat subdirectory webapps/slicr/web-inf/classes, where Tomcat will automatically place the CLASSPATH variable of the WebApps directory into that subdirectory.

Alternatively, you can use your favorite tool to convert the compiled class to a jar file, and then put the jar file into the Webapps/slicer/web-inf/lib directory. In addition, Tomcat puts the JAR file into the directory of the CLASSPATH variable.

Related Article

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.