What is JSP? JSP application instance: jsp application instance

Source: Internet
Author: User

What is JSP? JSP application instance: jsp application instance

Introduction: jsp is the abbreviation of Java Server Page. It is an extension of Servlet. His role is to simplify the website creation process and maintain dynamic websites. Html is more about displaying static pages. Servlet can display dynamic pages. jsp pages integrate html and Servlet. In addition to html text, jsp also contains the following content: (1) jsp command (2) jsp Declaration (3) jsp program fragment (4) jsp expression (5) jsp built-in object (the jsp built-in object is actually

Is the method parameter and local variable on the servlet service method)

Lifecycle: when a request contains a specific jsp page, it will process the jsp page as follows: (1) Find the corresponding servlet and call its service method if it exists. (2) if it does not exist

Servlet, parse jsp, translate it into source files, compile it into servlet classes, and initialize and execute it (jsp converted servlet is under the \ work directory of tomcat ).

1. Initialization phase: load the corresponding servlet (if not, parse the jsp file, translate it into the servletjava file, and compile the file) and create an instance, call the initialization method (the servlet initialization method generated by jsp is _ jspinit ()).

2. Running stage: run the servlet service method.

3. destruction method: Call the destroy method of servlet to destroy the instance.

Jsp request forwarding: tag of jsp request forwarding , The target component and source component share httpservletrequest,

Httpservletresponse object, and the code behind the tag will not be executed.

Jsp inclusion: jsp inclusion includes Dynamic and Static inclusion. <% @ include file = "absolute path or relative path" %> this command is static inclusion and only generates one servlet file,

Therefore, variables are shared between the source page and the contained page. Tags are dynamically contained. Different servlets are generated on the source and subpages.

At this time, the variables are not shared. (If flush is set to true, the request is returned before the sub-page is run)

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.