Common JSP Topic 8: basic concepts of JSP

Source: Internet
Author: User

JSP Question 1. What built-in objects does jsp have?

A: JSP has the following nine basic built-in components that correspond to the six internal components of ASP ):

Request client request, which contains parameters from the GET/POST request

Response returned from the response webpage to the client

The pageContext page is managed here.

Session-related session Period

Content being executed by application servlet

Out is used to send response output.

Configuration servlet framework

Page JSP page itself

Exception for the error webpage, exceptions not captured

JSP Question 2. What are the functions of jsp?

A: JSP has the following 6 basic actions:

Jsp: include: Introduce a file when the page is requested.

Jsp: useBean: Find or instantiate a JavaBean.

Jsp: setProperty: Set attributes of JavaBean.

Jsp: getProperty: outputs the attributes of a JavaBean.

Jsp: forward: Transfers requests to a new page.

Jsp: plugin: generate the OBJECT or EMBED tag for the Java Plug-in based on the browser type

JSP Question 3. What is the difference between dynamic and static INCLUDE in JSP?

Answer: Implement Dynamic INCLUDE with jsp: include action

It always checks changes in the contained files and is suitable for containing dynamic pages and can contain parameters

Static INCLUDE is implemented by using the include pseudo code and will not check the changes in the contained files. It is applicable to INCLUDE static pages.

JSP Question 4. Common JSP commands

IsErrorPage (whether the Exception object can be used), isELIgnored (whether to ignore the expression)

JSP Question 5. What are the similarities and differences between JSP and Servlet, and what are their connections?

A: JSP is an extension of Servlet technology. It is essentially a simple Servlet method, with more emphasis on the external expression of the application. After JSP compilation, it is "servlet-like ".

The main difference between Servlet and JSP is that the application logic of Servlet is in the Java file and is completely separated from the HTML in the presentation layer. In JSP, Java and HTML can be combined into a file with the extension. jsp.

JSP focuses on views. Servlet is mainly used for control logic.

JSP Question 6. How do I implement request forwarding in Jsp and Servlet?

JSP forwarding requests can be completed through the <jsp: forward> standard action. Servlet forwarding requests can be implemented through the forward () method.

JSP Question 7. What are the implicit objects in jsp? What are their roles?

Request indicates the HttpServletRequest object. It contains information about browser requests and provides several useful methods for obtaining cookie, header, and session data.

Response indicates the HttpServletResponse object, and provides several methods for setting the response sent back to the browser, such as cookies and header information)

The out object is an instance of javax. jsp. JspWriter. It provides several methods for sending output results to the browser.

PageContext indicates a javax. servlet. jsp. PageContext object. It is used to facilitate access to various namespaces and servlet-Related Object APIs, and encapsulates common servlet-related functions.

Session indicates a requested javax. servlet. http. HttpSession object. Session can store user status information

Application applicaton indicates a javax. servle. ServletContext object. This helps you find information about the servlet engine and servlet environment.

Config indicates a javax. servlet. ServletConfig object. This object is used to access the initialization parameters of the servlet instance.

Page indicates a servlet instance generated from this page.

Exception indicates exceptions generated during JSP page running.

JSP Question 8. What are the two jump methods? What is the difference?

A: There are two types:

<Jsp: include page = "embedded ded. jsp" flush = "true">

<Jsp: forward page = "nextpage. jsp"/>

The former page does not switch to the page referred to by include, but only displays the results of the page. The home page is still the original page. It will return after execution, which is equivalent to a function call. In addition, parameters can be included. The latter is completely redirected to the new page and will not be returned. It is equivalent to the go to statement.

  1. Implementation of Servlet File Download Function
  2. At the beginning of JSP Servlet Development
  3. Enhanced Servlet and JSP security without modifying code
  4. Servlet and JSP paths
  5. How to Improve Servlet and JSP Application Efficiency

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.