[Douyan] [1] 50 days of Web application development

Source: Internet
Author: User

Where can I start?


Let's start with friends we met in the previous section.


I met a friend in the circle. When he talked that he developed a system using SSH, I thought that SSH should be a communication protocol. He said in an irrevocable tone: uncle, you have been in this industry for so many years, don't you know SSH?


I am ashamed to say that I have been engaged in this industry for a short time. It seems that I have never been engaged in WEB development. When he said that SSH is for Struts, Spring, and Hibernate, I just understood the abbreviation of SSH. Coincidentally, when designing a prototype recently, the vertical website is filled with the whole website, and my mind is thinking about the chaos of medical care in China. If the common people can have a professional communication platform, the common-sense minor illness can be solved on its own, so the word "doujian" has been stuck in its mind. Let's go with it into my WEB development.


Before you begin, forget the various frameworks. We will not pursue any advanced technologies for the time being. Everything will go forward with our thinking. We know that users can use IE, Firefox, Chrome, and other commonly used browsers to view webpages. The webpage data is sent to the server through HTTP requests, the server accepts HTTP requests based on Jetty, Tomcat, and Weblogic, which are commonly used by WEB containers, and returns different resources to the browser based on the requests ,:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/141TSU7-0.png "title =" request "alt =" 225646395.png"/>

The first question is that how does the WEB Container parse HTTP requests? This is the most basic function of various WEB containers. Otherwise, it cannot be called a WEB container. But it can be clear that no matter which WEB container, it parses the WEB application is compliant with certain specifications, that is, the WEB application has a WEB-INF folder, it has a web. xml file below. The following creates web. xml under D: \ medical \ war \ WEB-INF \

NOTE: If no special statement is provided later, the WEB application will be developed in the Windows operating system.


The second question is, which WEB Container should we use? About the advantages and disadvantages of various WEB containers, you can search for them on google ). Download the package at http://tomcat.apache.org/download-80.cgi, and decompress it on the dashboard.


The third question is, how does Tomcat load this medical application? There is no love or hate for no reason in the world, so let Tomcat find it: Create medical. xml under D: \ tomcat8 \ conf \ Catalina \ localhost \, whose content is filled in:

<Context path="" docBase="D:\medical\war" debug="0" privileged="true" reloadable="true" crossContext="true"> </Context>


Is that all done? Not yet, imagine D: \ medical \ war \ WEB-INF \ web. xml is still empty! Enter the following content:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"><web-app>    <welcome-file-list>         <welcome-file>index.html</welcome-file>    </welcome-file-list></web-app>

Here, <welcome-file> index.html </welcome-file> indicates to enter the application system. First, open the Page D: \ medical \ war \ index.html. Because no metadata is configured here, the table indicates to use index.html under the web application.


Enter something in index.html, for example, I'm coming ....


The exciting time is coming. Double-click D: \ tomcat8 \ bin \ startup. bat script, the flash disappears, 650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/141TQV2-1.gif "alt =" j_0012.gif "/> I had a go. Don't be nervous because JAVA environment variables are not set.

NOTE: If JAVA environment variables are not set, google

1. Go to renewal

2. Assume that the SDK is installed in C: \ JDK7.

3. Run to the desktop, right-click my computer, and choose Properties> advanced> environment variable> system variable> New"

3.1 create a JDK directory variable: JAVA_HOME <-> C: \ JDK7

3.2 append Path setting: Path <->; % JAVA_HOME % \ bin

3.3 Add the CLASS_PATH variable <->.; % JAVA_HOME % \ lib


Now, the exciting time is coming again. Double-click D: \ tomcat8 \ bin \ startup. bat script. After the Tomcat service is started normally, enter http: // localhost: 8080/medical/in chrome. the following result is displayed:

650) this. width = 650; "src =" http://img1.51cto.com/attachment/201309/235832924.png "title =" result.png "alt =" 235832924.png"/>


Then carefully appreciate it, the browser HTTP looking for Tomcat, Tomcat looking for WEB-INF/web.xml, web.xmllooking for index.html, index.htmlback to the browser, the Browser contains index.html display to the user.


Note: The following situations may cause the instance to fail to run:

1. JDK and Tomcat versions do not match here JDK uses 7u15, Tomcat uses Tomcat 8)

2. Port Number 8080 occupied

If the above is not running, you can send a private message to me.

This article from the "Qingke" blog, please be sure to keep this source http://qingkechina.blog.51cto.com/5552198/1303925

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.