Android Server Development 1-build Java Web server with eclipse

Source: Internet
Author: User
Tags php server

This blog describes how to use eclipse to create a Java Web program, for the next talk through the Android client with the server to lay the foundation for interaction, on the server can choose a lot of programs, the mainstream is the Android client +php server, We can also use the Android client +java EE server as a match to see which way the company is provided.

To create a Java Web program without a particularly complex process, we'll prepare the raw materials:
1. Eclipse (Note: This is not an ADT Bundle, it is best to download the IDE for Java EE Development, if possible, it would be more convenient to select MyEclipse for Java ee)
2. Tomcat (when the Tomcat 7.x is downloaded here)
3. JDK (Note: This is a must, not much to say)

Download complete eclipse does not have to install, you can directly double-click Open, Tomcat if you are under a compressed package, unzip and put it in the appropriate place.

Here are the steps to configure (the configuration under Mac, similar to Windows):

Final finish completes the configuration.

Here's how to create a server step

After you create it, you need to modify the Tomcat configuration

Once modified, you can start Tomcat and access the http://localhost:8080/in your browser.

Here's how to create a Web program

After the creation is complete, create the boot in the WebContent directory, index.jsp

Then we launch Tomcat and visit our project:

Note: Be sure to make the Web. XML configuration file, and then create the appropriate startup page in WebContent, or you will be prompted with 404 errors.

/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" ><html><head><meta http-equiv="Content-type" Content="text/html; Charset=utf-8 "><title>Web</title></head><body>This is our first Web project.</body></html>

So far, we have described in detail how to build Java Web server through eclipse, you can try it yourself, if you have questions, leave a message to discuss.

Android Server Development 1-build Java Web server with eclipse

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.