Jsp
70. Differences between forward and redirect
A: forward is the server that requests resources. The server directly accesses the URL of the target address, reads the response content of the URL, and sends the content to the browser, the browser does not know where the content sent by the server comes from, so its address bar is still the original address.
Redirect means that the server sends a status code based on logic to tell the browser to request the address again. Generally, the browser will re-request the address with all the parameters just requested, so the session and request parameters can be obtained.
71. What built-in objects does jsp have? What are their roles?
A: JSP has the following nine basic built-in components (which can 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
72. What actions does jsp have? What are their roles?
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
73. What is the difference between dynamic INCLUDE and static INCLUDE in JSP?
Answer: Implement Dynamic INCLUDE with jsp: include action
<Jsp: include page = "embedded ded. jsp" flush = "true"/> it always checks changes in the contained files. It is suitable for inclusion of 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.
<% @ Include file = "included.htm" %>
74. 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.
75. built-in JSP objects and methods.
A: 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 (such as cookies and header information) for setting the response to the browser)
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 the javax. servlet. http. HttpSession object of a request. Session can store user status information
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 the page.