Using JSP to develop Dynamic Web site Basics __jsp

Source: Internet
Author: User
Tags naming convention tomcat

1, what is the Dynamic Web page.

Dynamic Web pages are programs or Web pages that run on the server side, and they return different pages with different customers and at different times.

NOTE: Insert flash in the static Web page, although Flash is moving, but it is not to say that this page is a Dynamic Web page. Refer to the features of dynamic Web pages.

2, the characteristics of dynamic Web pages.

(1), interactive: That is, the Web page will be based on user requirements and choice of dynamic change and response. The Web site with Dynamic Web technology can realize the interactive function with the user.

(2), Automatic Update: No manual operation, will automatically generate a new page, you can save work.

(3), randomness: that is, when different time, different people visit the same site will produce different page effects.

3, why the need for dynamic Web pages.

Static Web pages do not really interact with users. Static Web content is fixed, when the elements of the page are modified, you need to upload the page to the server to overwrite the original page. Not conducive to maintenance work. and dynamic Web pages can make up for these shortcomings.

3, what is b/s technology (structure, mode), what is C/s technology (structure, mode).

b/S (browser/server, browser/server). In this structure, the program is completely on the server, and through the application server with the database server communication, the client does not need to install the client software, the system interface is displayed through the browser.

c/S (client/server, client/server). Divided into two tiers of client and server, the application software installed on the client side, through the network and the database server side to communicate with each other.

4, b/s structure and C/s structure compared to the advantages and disadvantages.

(1), maintenance and upgrade method is simple. Each client of the C/s structure must install and configure the software. In the B/s structure, the software's business logic is completely on the server side, all the clients are just browsers, do not need to do any maintenance, software upgrades, only to upgrade the server's software to the latest version can be, customers in the client login system is already the latest version.

(2), user access to a greater extent. c/S is built on the basis of LAN, B/S is based on the Internet.

b/S interface does not have C/s interface friendly, b/s interface is not rich.

5, why need to learn B/s technology.

When we deploy the application system, B/s can effectively reduce our daily work maintenance, but also allow a wider range of users to access the system.

6, the development of JSP Dynamic Web site.

(1), creating a Web project. (using the MyEclipse tool).

FILE->NEW->PROJECT->MYECLIPSE->J2EE Projects->web Project

Note: When creating a project, pay attention to the name of the ProjectName (project name) and Conttext root (access path name) URL, and if the two are different, the URL fills in the access path name at the time of the access. The default is the same, which is the same as the one that was filled in during the visit.

(2), design the directory structure of the Web project.

SRC directory: Used to store Java source files.

Webroot Directory: The top-level directory of Web applications, also known as the document root directory. It consists of the following sections:

Meta-inf Directory: System automatically generated, storage System description information.

Static files: Include all HTML pages, CSS files, image files, and so on. Generally by function in the form of folders classification.

JSP files: The use of JSP can easily generate dynamic content in the page, so that Web applications can output colorful dynamic pages.

Web-inf directory: exists in the document root directory, cannot be referenced, cannot publish externally. The Lib and Web.xml sections are included in this directory.

Lib directory: includes. jar or. zip file (database driver, etc.).

The initialization configuration file for the Web application.

(3), writing the code for the Web project.

Select Webroot Document Root right-->new->html (Advanced Templates)-> Write code

(4), deploying Web projects. (The application server used is Tomcat).

To deploy: Right-click the project file->myeclipse-> Add and Remove project deployments.....-> Select the project you want to deploy-> click the Add button-Select server is Tomcat 5- > Click the Finish button-> click the OK button.

(5), run the Web project. Start Tomcat and enter URL access in the browser.

Click the Run icon-> Select the Tomcat 5->start command.

Some information about console output is explained:

Info: Starting Coyote http/1.1 on http-8080

Tip The Tomcat service is started on port 8080.

Info: Server Startup in 3703 MS

Tip After 3703 milliseconds Tomcat has been started, different project startup time is different.

7, what is the URL

The URL is the abbreviation for Uniform Resource location, translated as "Uniform Resource Locator." A URL is the only naming convention that can identify the location of specific computers, directories, or files on the Internet.

The format of the URL consists of the following three parts.

The first part: agreement.

Part II: Host IP address (sometimes including port number).

The third part: the specific address of the host resource, such as directory and filename.

The first part and the second part are separated by "://", and the second and third parts are separated by the "/" symbol. Of these, the first part and the second part are indispensable, and the third part can be omitted sometimes.

Http:localhost:8080/xinxin/index.html

Host IP address is: localhost, port number: 8080, Web site specific location:: xinxin/index.html

Xinxin is an externally released virtual context path, which is actually the document root directory (WebRoot) of the Web application.

8, the development of Web projects often make mistakes

Behavior: Unable to display Web page.

Cause: The Tomcat service was not started, or the Tomcat service was not started in the desired port.

Phenomenon: 404 error.

Reason: 1, the Tomcat service has been started, but Web applications are not deployed.

2, or the Tomcat service has been started, and Web applications have been deployed. URL input error, see if the first two parts of the URL are typed correctly. (http://localhost:8080), and then see if the context path is correct (right key item Àpropertiesàmyeclipseàwebàweb context-root).

3, or the Tomcat service has been started, and Web applications have been deployed. The URL also looks correct. Review the location of the files you want to access, check to see if the files are stored in the Meta-inf or Web-inf folder, the contents of the two folders cannot be published, cannot be referenced (not directly through the address, can only be accessed within the program). Place the file you want to access under the document root.

9, the development of JSP Dynamic Web site steps are as follows:

Create a Web project.

Design the directory structure for your Web project.

Code that writes a Web project.

Deploy the Web project.

Run the Web project.

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.