Javaweb Study Summary (i)--javaweb Development Introduction (reprint)

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

Reproduced from http://www.cnblogs.com/xdp-gacl/p/3729033.html thanks to the lonely wolf sharing.

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 staticWebprogram, the client uses theWeb Browser (ie firefox Connect to the server, use http protocol initiates a request (requestwebweb server according to the needs of users, Remove the content from the file system (the disk that holds all the static pages). Then through web The server is returned to the client, After the client receives the content, it is parsed by the browser rendering and the results are 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: "TheWeb page display effect due to people change", and dynamic Web has interactivity, the content of theWeb page can be updated dynamically. The process diagram for the entire dynamic WEB operation is as follows:

dynamic ie< Span style= "font-family: the song Body;" >, firefox etc), through the network Connect to the server, use http protocol initiation Request (requestweb server plugin

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

IfWEB Server Plugin Discovery ClientThe request isDynamic Resources (*.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, handing over all the content to the Web server, and then sending the content back through the Web server the client browser performs parsing.

1.6. The means of implementing Dynamic Web application

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 Dynamics web development is early , and the earliest in the domestic most popular is aspasp is vbasp+comasp

The ASP itself has the limitations of the development platform: Windows+iis+sql server/access,asp can only run on Windows operating systems, ASP is now basically obsolete, and is now basically developed using ASP. ASP. performance has been greatly improved and developed rapidly, but is still limited by the platform. the C # language is primarily used in ASP .

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.

SUNThe company launched the firstWebTechnology is the introduction ofServletProgramServletThere are some problems when using the program itself, and all the programs are usedJavaCode+htmlWay, that is, to use thejava output statement, one line output all html code, then sunasp inspired by the development of jsp some code writing effect and is very similar. This makes it easy to make some asp programmer turns jsp

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 in the Apache Software Foundation's Jakarta Project, from Apache, Sun Developed together with 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 torefer 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.

Javaweb Study Summary (i)--javaweb Development Introduction (reprint)

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.