Static Resources and dynamic resources

Source: Internet
Author: User

Manually developing dynamic Resources

1 The difference between static and dynamic resources

Static resources: When a user accesses this resource multiple times, the source code of the resource never changes the resource.

Dynamic resource: When a user accesses this resource multiple times, the source code of the resource may send a change.

Development technology of dynamic resources

Servlet: The Java language to write dynamic resource development techniques.

Servlet Features:

1) Common Java class, inherit HttpServlet class, overwrite Doget method

2) The Servlet class can only be handed to the TOMCAT server!!!! (developers can't run themselves!!!) )

The servlet manually writes the steps:

1) Write a servlet program that inherits HttpServlet

2) Locate the class bytecode of the HelloServlet classes and copy them to the Web-inf/classes directory in a Tomcat Web application.

3) Configure the servlet in the Web. xml file under the current application.

4) Start the Tomcat server, run access

Visit Servlet:http://localhost:8080/myweb/hello

Tool development Dynamic Resources

1) Create Web project (Javaweb project)

2) Create a static resource file under Webroot,

3) Create a dynamic resource file under SRC

3.1 New---servlet (servlet code generator)

3.2 Write Pacakge, class name, modify mapping URL

4) Associating a Tomcat server

4.1 window-> Preferences-> myecplise-Servers Tomcat 6.x (note Be sure to enable)

5) Deploy the Web project app. (Copy web App to Tomcat's WebApps directory)

6) Start the Tomcat server

7) Accessing the servlet Http://localhost:8081/day08_web/hello

Static Resources and dynamic resources

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.