Java Web Learning Summary (i) Basic concepts

Source: Internet
Author: User
Tags tomcat server websphere application server

I. Basic concepts 1.1, Web development related knowledge

Web, in English, the web means the Web page, which is used to represent the resources that the Internet host is available for outside access.
Web resources on the Internet for external access are divided into:

    1. Static Web resources (such as HTML pages): Data that is accessible to people in a Web page is always the same.
    2. Dynamic Web resources: refers to the Web page for people to browse the data is generated by the program, at different points of time to access the Web page to see the content varies.

Static Web Resource development technology: Html
Common Dynamic Web Resources development technology: Jsp/servlet, ASP, PHP, etc.
In Java, Dynamic Web resource development technologies are collectively referred to as Javaweb.

1.2. Web Application

Web applications means browser-accessible programs, often referred to as Web applications. For example, there are a.html, b.html ... multiple Web resources, which are used to provide services externally, these Web resources should be placed in a directory to form a Web application (or Web application)
A Web application consists of several static Web resources and dynamic Web resources, such as HTML, CSS, JS files, JSP files, Java programs, support jar packages, configuration files, and so on.
  After the development of Web applications, if you want to be accessible to the outside world, you need to give the Web application directory to the Web server management, this process is called virtual directory mapping

1.3. Web History

Two phases of web development: static, dynamic

1.4. Static Web

*htm, *html, these are the Web page suffix, if now on a server directly read the content, it means that the content of these pages through the Web server display to the user. The process diagram for the entire static web operation is as follows:

In a static Web program, the client uses a Web browser (IE, Firefox, etc.) to connect to the server, use the HTTP protocol to initiate a request, tell the server which page I need to get now, and all the requests to the Web server. The Web server then extracts the content from the file system (the disk that holds all the static pages), depending on the user's needs. After the Web server is returned to the client, the client receives the content after the browser rendering parsing, to get the effect displayed.

  There are several drawbacks to the static Web:

  1, the content of the Web page can not be updated dynamically, all users see the content and the final effect is the same.

In order to make the static web display more attractive, you can add JavaScript to complete some of the page display effects, but these effects are on the client with the help of the browser display to the user, so on the server itself does not have any changes.

means to implement static Web client dynamic effects:

    • Javascript
    • VBScript

JavaScript is used most in real-world development.

  2, static web can not connect to the database, can not implement and user interaction.

Using a database to save data is now a choice for most systems, because data can be easily managed in the database, and additions and deletions can be done using standard SQL statements.

1.5. Dynamic Web

The so-called dynamic does not mean that the page will move, the main feature is: "The Web page display effect due to people change", and Dynamic web has interactivity, the content of the Web page can be updated dynamically. The process diagram for the entire dynamic web operation is as follows:

In the Dynamic web, the program still uses the client and the server, the client still uses the browser (IE, Firefox, etc.), connects to the servers over the network, uses the HTTP protocol to initiate requests (request), and all requests now go through a Web server Plugin (server plug-in), which is used to differentiate whether a static resource is requested (*.htm or *.htm) or a dynamic resource.

If the Web server plugin discovers that the client is requesting a static resource (*.htm or *.htm), the request is forwarded directly to the Web server, after which the Web server takes the content out of the file system and sends it back to the client browser for resolution execution.

If Web Server plugin discovers that the client is requesting a dynamic resource (*.jsp, *.asp/*.aspx, *.php), the request is forwarded to the Web Container (Web container), the database is connected in the Web Container, After a series of operations, such as extracting data from a database, and then dynamically piecing together the contents of the page, putting together the content of the page, all the content is presented to the Web server, and then the content is sent back to the client browser through the Web server for parsing and execution.

1.6, Dynamic Web application implementation means

Dynamic web is now implemented in a number of ways, the more common are the following:

    • Microsoft asp, ASP.
    • Php
    • JAVA servlet/jsp
1. Microsoft asp, ASP.

Microsoft Dynamic Web Development is relatively early, and the earliest in the domestic most popular is the ASP. ASP is in the HTML language to add the VB Script, but the standard development application should be used asp+com, but the actual situation, in the development of ASP is basically in a page to write hundreds of thousands of code, page code is extremely chaotic.

The ASP itself has the limitation of development platform: Windows+iis+sql server/access,asp can only run on Windows operating system, ASP is now basically obsolete, This is mostly done with ASP. ASP. NET has improved performance and developed rapidly, but it is still limited by the platform. Asp. NET is primarily used in the C # language.

2.PHP

PHP Development is fast, powerful, cross-platform (platform refers to the operating system), and the code is simple.

3.servlet/jsp

This is the implementation language of the B/s architecture that Sun (which Sun has now been acquired by Oracle) and is based on the Java language, because the Java language is simple enough and clean.

The performance of servlet/jsp technology is also very high, not limited by the platform, each platform can be used basically. And in the run is the use of multi-threaded processing, so the performance is very high.

Sun's first launch of the Web technology introduced a servlet program, the servlet program itself, there are some problems, all the program is written in Java code +html, that is, to use the Java output statement, a line of output all the HTML code, and then , Sun has been inspired by the ASP, the development of JSP (Java Server Page), JSP some code writing effect and ASP is very similar. This makes it easy for some ASP programmers to turn to JSP learning and increase the market competition.

Second, Web server 2.1,Introduction to Web servers

1. A Web server is a program that resides on some type of computer on the Internet and is a program that can provide documentation to the requesting browser. When a Web browser (client) connects to a server and requests a file, the server processes the request and feeds the file back to the browser, which tells the browser how to view the file (that is, the file type).

2. The server is a passive program: The server responds only when a request is made by a browser running on the Internet on another computer.

2.2, common Web server Introduction 1, WebLogic WebLogic is a U.S. BEA company produced a application server. BEA WebLogic is a Java application server for developing, integrating, deploying, and managing large-scale distributed web applications, Web applications, and database applications. Introduce the dynamic capabilities of Java and the security of Java Enterprise standards into the development, integration, deployment, and management of large-scale network applications. is currently the most widely used Web server, support the Java EE specification, and constantly improve to adapt to the new development requirements, launch interface 2, WebSphere

WebSphere Application Server is a fully functional, open Web application Server, a core part of IBM's e-business plan, a Java-based application environment for building, deploying, and managing the Internet and Intranet Web Application. This complete set of products has been scaled to fit the needs of Web application servers, ranging from simple to advanced to enterprise level. Start interface

3. Tomcat

Tomcattomcat is a minimal Web server that implements the Java EE Standard and is a core project of the Apache Software Foundation's Jakarta Project, developed by Apache, Sun, and other companies and individuals. Because of advanced Tomcat technology, stable performance, and open source free, so deeply loved by Java enthusiasts and have been recognized by some software developers, become the most popular Web application server. Learning Javaweb development generally uses the Tomcat server, which supports all JSP and servlet specifications, starting the interface

4.IISMicrosoft's Web server product is Internet Information Services (IIS), which is a Web server that allows information to be published on the public intranet or the Internet. Ⅱs is one of the most popular Web server products, and many famous websites are built on the Ⅱs platform.  IIS provides a graphical interface for administrative tools, called Internet Information Services Manager, that you can use to monitor configuration and control Internet services. IIS is a Web services component that includes Web servers, FTP servers, NNTP servers, and SMTP servers for Web browsing, file transfer, news services, and mail delivery, which makes it easy to publish information on the network, including the Internet and local area networks. It provides an ISAPI (Intranet server API) as a programming interface for extending Web server functionality, and it also provides an Internet database connector that enables queries and updates to the database.

To learn web development, you need to install a Web server and then develop the appropriate Web resources in the Web server for users to access using a browser.

Third, build Javaweb application development Environment--TOMCAT Server 3.1, Question: Learn Web development, why must first install a Web server?

Creating a Web page on the local computer is not accessible to the user, but if you start the Tomcat server and place the Web page on the Tomcat server, the user will be able to access it. What does that mean?
1, no matter what web resources, want to be accessed by a remote computer, must have a corresponding network communication program, when the user to access, the network communication program read the Web resource data, and send the data to the visitors .
2, Web server is such a program, it is used to complete the underlying network communication. Using these servers, we developers need to focus on how the Web resources are written, without caring how the resources are sent to the client, greatly reducing developer effort.

3.2. Download and install the Tomcat server

Tomcat Official site: http://jakarta.apache.org

Download the Tomcat installer package: http://tomcat.apache.org/

  

Click "Download" to jump to the download page as shown

    1. tar.gz files are installed under the Linux operating system
    2. EXE file is the installation version under Windows system
    3. ZIP file is a compressed version under Windows system

After the download is complete, a compressed package is obtained, and the compressed package can be unpacked to complete the installation of the Tomcat server.

  

After extracting the compressed package, you get the folder as shown, which completes the installation of the Tomcat server.

  

3.3. Start and test the Tomcat server

  

Start the Tomcat server

Double-click the Startup.bat file in the bin directory to start the Tomcat server

    

      

Testing the Tomcat server

Open the browser, enter http://localhost:8080/, can display the following interface to indicate the successful installation.

    

3.4. Tomcat Startup FAQ

The reason why the Tomcat server does not start properly is generally the following two:

1, Java_home environment variable setting problem

To double-click the Startup.bat file in the bin directory to start the Tomcat server, the first thing to do is to set the JAVA_HOME environment variable in Windows, because the Tomcat server starts with this java_home environment variable, If the JAVA_HOME environment variable does not exist in Windows, the Tomcat server cannot be started.

Configuring the Java_home variable in window

Operation Steps (Win7 system): Computer → right Button "Properties" → advanced system settings → advanced → environment variables as shown:

    

    

    

Click " New " Under the system variable, pop up a new system Variable dialog box, first in the variable name write Java_home, as the name implies, the meaning of Java_home is the JDK installation path, and then in the variable value to write the JDK installation path, If the variable value set here is "D:\Program Files (x86) \java\jdk1.7.0", after setting the value of the variable, click the "OK" button, the JAVA_HOME environment variable is set to complete, as shown in: System variable more than one " Java_home "variable.

    

Normally, the first step in learning JAVA development is to configure the PATH environment variable, which is better configured by first configuring the JAVA_HOME environment variable and then using "%java_home%" in the path variable to refer to the value of the Java_home variable.

    

So this java_home environment variable is usually configured in window, and if you forget to configure the JAVA_HOME environment variable, you can configure it in the way described above

2. Port occupancy Issues

Because the Tomcat server starts with a default of 8080 port, if the 8080 port is occupied by another application, then the Tomcat server will not start properly, the phenomenon is that "the Tomcat server boot interface will print an exception error message, and then automatically shut down the "As shown in:

  

Since this window is very short from start to close, it is difficult to see the error message when Tomcat starts, so we can only check the Tomcat server's operation through the log (log) information of the Tomcat server.

There is a logs folder under the root directory of the Tomcat server,

  

Logs folder for Tomcat log files, open the Logs folder, you can see the log file inside, which has a "catalina.yyyy-mm-dd.log" form named log file, for example " Catalina.2014-05-17.log "Log files are the records of the day that Tomcat server 2014-05-17 is running.

  

Open the Catalina.2014-05-17.log file to see the log information inside,

  

Log information is clearly recorded in the operation of the Tomcat server, if the 8080 port is occupied and can not start properly, the exception is recorded as shown in the information, by looking at the exception information, we can know why the Tomcat server can not start properly!

Summary: When the Tomcat server fails to start correctly, first check that the JAVA_HOME environment variable is configured, and then check that the port on which the Tomcat server starts is occupied by another application.

Java Web Learning Summary (i) Basic concepts

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.