Static and Dynamic Resources

Source: Internet
Author: User

Static and Dynamic Resources
Manual development of dynamic resources

1. Differences between static and dynamic resources

Static resources: Resources whose source code will never change when users access this resource multiple times.

Dynamic Resource: when a user accesses this resource multiple times, the source code of the resource may be changed.

Dynamic Resource Development Technology

Servlet: Development Technology for writing Dynamic Resources in java.

 

Servlet features:

1) A common java class that inherits the HttpServlet class and overwrites the doGet Method

2) The Servlet class can only be handed over to the tomcat server for running !!!! (Developers cannot run it themselves !!!)

 

Servlet manual writing steps:

1) Write a servlet program that inherits HttpServlet

2) Find the class bytecode of the HelloServlet class and copy it to the WEB-INF/classes directory in a web application of tomcat.

3) configure the Servlet in the web. xml file of the current web application.

4) Start the tomcat server and run the access

Access servlet: http: // localhost: 8080/myweb/hello

 

 

Dynamic Resources for tool development

1) create a 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) associate with the tomcat server

4.1 window-> Preferences-> MyEcplise-> servers-> Tomcat 6.x (Be sure to enable)

 

5) Deploy the web project application. (Copy the web application to the tomcat webapps directory)

6) Start the tomcat server

7) Access servlet http: // localhost: 8081/day08_web/hello

 

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.