Android server development 1-use Eclipse to build a Java Web server, androideclipse

Source: Internet
Author: User
Tags php server

Android server development 1-use Eclipse to build a Java Web server, androideclipse

This blog introduces how to use Eclipse to create a Java Web program, which lays the foundation for interaction between the Android client and the server. There are many programs available for the server, the mainstream combination is the Android client + PHP server. We can also use the Android client + Java EE server to see which method the company provides.

There is no complicated process to create a Java Web program. First, prepare the raw materials:
1. Eclipse (note: this is not an ADT Bundle. It is best to download the IDE for developing Java EE from the official website. If you can, it is more convenient to select MyEclipse for Java EE)
2. tomcat (tomcat 7.xis downloaded here)
3. jdk (note: this is required, not to mention)

You do not need to install Eclipse after downloading. You can double-click it to open it. If you have a compressed package under tomcat, decompress the package and place it in the appropriate place.

The configuration steps are as follows (for mac configuration, windows is similar ):

Finish the configuration.

To create a Server, follow these steps:

After creation, you need to modify the tomcat configuration

After modification, start tomcat and access http: // localhost: 8080/in the browser/

The following is how to create a Web program

After the WebContent is created, the WebContent directory is created and started. index. jsp

Then we start tomcat and access our project:

Note: The web. xml configuration file must be used to create a startup page in WebContent. Otherwise, the Error 404 is displayed.

/Web/WebContent/WEB-INF/web. xml

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">  <display-name>web</display-name>  <welcome-file-list>    <welcome-file>index.html</welcome-file>    <welcome-file>index.htm</welcome-file>    <welcome-file>index.jsp</welcome-file>    <welcome-file>default.html</welcome-file>    <welcome-file>default.htm</welcome-file>    <welcome-file>default.jsp</welcome-file>  </welcome-file-list></web-app>

/Web/WebContent/index. jsp

<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %> <! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd"> 

So far, I have introduced in detail how to build a Java Web server through Eclipse. You can give it a try by yourself. If you have any questions, leave a message to discuss them.

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.